Skip to content

Commit

Permalink
Add primary method on migration generator for UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
nafiesl committed Apr 20, 2021
1 parent cf4be00 commit 2321e9c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Generators/MigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getContent(string $stubName)
$content = $this->replaceStubString($this->getStubFileContent($stubName));

if ($this->command->option('uuid')) {
$content = str_replace("\$table->bigIncrements('id')", "\$table->uuid('id')", $content);
$content = str_replace("\$table->bigIncrements('id')", "\$table->uuid('id')->primary()", $content);
}

return $content;
Expand Down
2 changes: 1 addition & 1 deletion tests/CommandOptions/UuidOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Create{$this->plural_model_name}Table extends Migration
public function up()
{
Schema::create('{$this->table_name}', function (Blueprint \$table) {
\$table->uuid('id');
\$table->uuid('id')->primary();
\$table->string('title', 60);
\$table->string('description')->nullable();
\$table->foreignId('creator_id')->constrained('users')->onDelete('restrict');
Expand Down

0 comments on commit 2321e9c

Please sign in to comment.