Skip to content

Commit 076f226

Browse files
Merge pull request #48 from nathane/feature/change-id-column-datatype-to-bigincrements
Fix the migration datatype of an `id` column
2 parents 8a2b7d3 + e83969c commit 076f226

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

src/Generators/MigrationGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function buildDefinition(Model $model)
5858
foreach ($model->columns() as $column) {
5959
$dataType = $column->dataType();
6060
if ($column->name() === 'id') {
61-
$dataType = 'increments';
61+
$dataType = 'bigIncrements';
6262
} elseif ($column->dataType() === 'id') {
6363
$dataType = 'unsignedBigInteger';
6464
}

tests/fixtures/migrations/comments.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CreateCommentsTable extends Migration
1414
public function up()
1515
{
1616
Schema::create('comments', function (Blueprint $table) {
17-
$table->increments('id');
17+
$table->bigIncrements('id');
1818
$table->text('content');
1919
$table->timestamps();
2020
});

tests/fixtures/migrations/identity-columns.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CreateRelationshipsTable extends Migration
1414
public function up()
1515
{
1616
Schema::create('relationships', function (Blueprint $table) {
17-
$table->increments('id');
17+
$table->bigIncrements('id');
1818
$table->unsignedBigInteger('post_id');
1919
$table->unsignedBigInteger('another');
2020
});

tests/fixtures/migrations/modifiers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CreateModifiersTable extends Migration
1414
public function up()
1515
{
1616
Schema::create('modifiers', function (Blueprint $table) {
17-
$table->increments('id');
17+
$table->bigIncrements('id');
1818
$table->string('title')->nullable();
1919
$table->string('name', 1000)->unique()->charset('utf8');
2020
$table->string('content')->default('');

tests/fixtures/migrations/posts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CreatePostsTable extends Migration
1414
public function up()
1515
{
1616
Schema::create('posts', function (Blueprint $table) {
17-
$table->increments('id');
17+
$table->bigIncrements('id');
1818
$table->string('title');
1919
$table->timestamps();
2020
});

tests/fixtures/migrations/readme-example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CreatePostsTable extends Migration
1414
public function up()
1515
{
1616
Schema::create('posts', function (Blueprint $table) {
17-
$table->increments('id');
17+
$table->bigIncrements('id');
1818
$table->string('title', 400);
1919
$table->longText('content');
2020
$table->timestamp('published_at')->nullable();

tests/fixtures/migrations/relationships.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CreateCommentsTable extends Migration
1414
public function up()
1515
{
1616
Schema::create('comments', function (Blueprint $table) {
17-
$table->increments('id');
17+
$table->bigIncrements('id');
1818
$table->unsignedBigInteger('post_id');
1919
$table->unsignedBigInteger('author_id');
2020
$table->timestamps();

tests/fixtures/migrations/soft-deletes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CreateCommentsTable extends Migration
1414
public function up()
1515
{
1616
Schema::create('comments', function (Blueprint $table) {
17-
$table->increments('id');
17+
$table->bigIncrements('id');
1818
$table->unsignedBigInteger('post_id');
1919
$table->softDeletes();
2020
$table->timestamps();

tests/fixtures/migrations/with-timezones.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CreateCommentsTable extends Migration
1414
public function up()
1515
{
1616
Schema::create('comments', function (Blueprint $table) {
17-
$table->increments('id');
17+
$table->bigIncrements('id');
1818
$table->softDeletesTz();
1919
$table->timestampsTz();
2020
});

0 commit comments

Comments
 (0)