Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add primary modifier #203

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class ColumnModifierFactory
'generatedAs' => GeneratedAsModifier::class,
'index' => IndexModifier::class,
'nullable' => NullableModifier::class,
'primary' => PrimaryModifier::class,
'storedAs' => StoredAsModifier::class,
'unique' => UniqueModifier::class,
'unsigned' => UnsignedModifier::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types=1);

namespace UcanLab\LaravelDacapo\Dacapo\Domain\Schema\Table\Column\ColumnModifier;

final class PrimaryModifier extends ColumnModifier
{
/**
* @return string
*/
public function getName(): string
{
return 'primary';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('example4', function (Blueprint $table) {
$table->string('id')->primary();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('example4');
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ example3:
- columns: [no, joined_year]
type: primary
name: example_primary

example4:
columns:
id:
type: string
primary: