diff --git a/src/Schema/Migrator.php b/src/Schema/Migrator.php index 74c6320ac0..e930e1487e 100644 --- a/src/Schema/Migrator.php +++ b/src/Schema/Migrator.php @@ -266,13 +266,16 @@ public function field(string $fieldName, array $options = []): self return $this; } - public function id(string $name = 'id'): self + /** + * @param array $options + */ + public function id(string $name = 'id', array $options = []): self { - $options = [ + $options = array_merge([ 'type' => 'integer', 'ref_type' => self::REF_TYPE_PRIMARY, 'nullable' => false, - ]; + ], $options); $this->field($name, $options); diff --git a/src/Schema/TestCase.php b/src/Schema/TestCase.php index 810d226c08..24e16e8eec 100644 --- a/src/Schema/TestCase.php +++ b/src/Schema/TestCase.php @@ -263,7 +263,7 @@ public function setDb(array $dbData, bool $importData = true): void $idColumnName = isset($fieldTypes['_id']) ? '_id' : 'id'; // create table - $migrator->id($idColumnName); + $migrator->id($idColumnName, isset($fieldTypes[$idColumnName]) ? ['type' => $fieldTypes[$idColumnName]] : []); foreach ($fieldTypes as $k => $fieldType) { if ($k === $idColumnName) { continue;