diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php index a3cddae4bd28..3db52937dc23 100755 --- a/src/Illuminate/Database/Schema/Blueprint.php +++ b/src/Illuminate/Database/Schema/Blueprint.php @@ -327,7 +327,7 @@ public function addAlterCommands(Connection $connection, Grammar $grammar) public function creating() { return collect($this->commands)->contains(function ($command) { - return $command->name === 'create'; + return ! $command instanceof ColumnDefinition && $command->name === 'create'; }); } diff --git a/tests/Integration/Database/DatabaseSchemaBlueprintTest.php b/tests/Integration/Database/DatabaseSchemaBlueprintTest.php index 6ef517094e84..6e755b41e93b 100644 --- a/tests/Integration/Database/DatabaseSchemaBlueprintTest.php +++ b/tests/Integration/Database/DatabaseSchemaBlueprintTest.php @@ -507,6 +507,19 @@ public function testAddUniqueIndexWithNameWorks() $this->assertEquals($expected, $queries); } + public function testAddColumnNamedCreateWorks() + { + Schema::create('users', function (Blueprint $table) { + $table->string('name'); + }); + + Schema::table('users', function (Blueprint $table) { + $table->string('create'); + }); + + $this->assertTrue(Schema::hasColumn('users', 'create')); + } + public function testDropIndexOnColumnChangeWorks() { $connection = DB::connection();