diff --git a/src/Phinx/Db/Adapter/PostgresAdapter.php b/src/Phinx/Db/Adapter/PostgresAdapter.php index 3ee358118..f0700d0ea 100644 --- a/src/Phinx/Db/Adapter/PostgresAdapter.php +++ b/src/Phinx/Db/Adapter/PostgresAdapter.php @@ -213,10 +213,6 @@ public function createTable(Table $table, array $columns = [], array $indexes = ->setType('integer') ->setIdentity(true); - if (isset($options['limit'])) { - $column->setLimit($options['limit']); - } - array_unshift($columns, $column); if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) { throw new InvalidArgumentException('You cannot enable an auto incrementing ID field and a primary key'); diff --git a/src/Phinx/Db/Adapter/SQLiteAdapter.php b/src/Phinx/Db/Adapter/SQLiteAdapter.php index 08fc074ec..5c624fa33 100644 --- a/src/Phinx/Db/Adapter/SQLiteAdapter.php +++ b/src/Phinx/Db/Adapter/SQLiteAdapter.php @@ -373,10 +373,6 @@ public function createTable(Table $table, array $columns = [], array $indexes = ->setType('integer') ->setIdentity(true); - if (isset($options['limit'])) { - $column->setLimit($options['limit']); - } - array_unshift($columns, $column); } diff --git a/src/Phinx/Db/Adapter/SqlServerAdapter.php b/src/Phinx/Db/Adapter/SqlServerAdapter.php index 6697fcdf9..760568fff 100644 --- a/src/Phinx/Db/Adapter/SqlServerAdapter.php +++ b/src/Phinx/Db/Adapter/SqlServerAdapter.php @@ -238,10 +238,6 @@ public function createTable(Table $table, array $columns = [], array $indexes = ->setType('integer') ->setIdentity(true); - if (isset($options['limit'])) { - $column->setLimit($options['limit']); - } - array_unshift($columns, $column); if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) { throw new InvalidArgumentException('You cannot enable an auto incrementing ID field and a primary key'); diff --git a/tests/Phinx/Db/Adapter/MysqlAdapterTest.php b/tests/Phinx/Db/Adapter/MysqlAdapterTest.php index 235c6bb95..fdaa0786e 100644 --- a/tests/Phinx/Db/Adapter/MysqlAdapterTest.php +++ b/tests/Phinx/Db/Adapter/MysqlAdapterTest.php @@ -459,6 +459,16 @@ public function testCreateTableWithUnsignedNamedPK() $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); } + public function testCreateTableWithLimitPK() + { + $table = new \Phinx\Db\Table('ntable', ['id' => 'id', 'limit' => 4], $this->adapter); + $table->save(); + $this->assertTrue($this->adapter->hasTable('ntable')); + $this->assertTrue($this->adapter->hasColumn('ntable', 'id')); + $column_definitions = $this->adapter->getColumns('ntable'); + $this->assertSame($this->usingMysql8() ? null : 4, $column_definitions[0]->getLimit()); + } + public function testCreateTableWithSchema() { $table = new \Phinx\Db\Table(MYSQL_DB_CONFIG['name'] . '.ntable', [], $this->adapter);