From 898ddd389ef2c0c92ad299eed558c606cca95a7a Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Sun, 14 Dec 2025 01:41:45 +0330 Subject: [PATCH] add a test --- .../Database/SchemaBuilderTest.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Integration/Database/SchemaBuilderTest.php b/tests/Integration/Database/SchemaBuilderTest.php index 1628a5b7ac76..e6523381bf8a 100644 --- a/tests/Integration/Database/SchemaBuilderTest.php +++ b/tests/Integration/Database/SchemaBuilderTest.php @@ -817,4 +817,25 @@ public function testAddingMacros() $this->assertTrue(Schema::hasForeignKeyForColumn('question_id', 'answers', 'questions')); $this->assertFalse(Schema::hasForeignKeyForColumn('body', 'answers', 'questions')); } + + #[RequiresDatabase(['mysql', 'mariadb', 'pgsql'])] + public function testStartingValueForAutoIncrementingColumn() + { + Schema::create('test', function (Blueprint $table) { + $table->bigIncrements('id')->from(100); + $table->string('name'); + }); + + $id = DB::table('test')->insertGetId(['name' => 'foo']); + + $this->assertSame(100, $id); + + Schema::table('test', function (Blueprint $table) { + $table->bigIncrements('id')->from(200)->change(); + }); + + $id = DB::table('test')->insertGetId(['name' => 'bar']); + + $this->assertSame(200, $id); + } }