Skip to content

Commit 4c27aa3

Browse files
authored
Moved migrations of columns to yii-db-migration (#509)
* Moved migrations of columns to yii-db-migration * test fix * tests update * tests update * tests update
1 parent 9c236ea commit 4c27aa3

7 files changed

Lines changed: 93 additions & 788 deletions

File tree

src/Migration/AbstractMigrationBuilder.php

Lines changed: 0 additions & 338 deletions
This file was deleted.

tests/Command/CommandTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ public function testCreateTable(): void
225225
$db = $this->getConnection();
226226

227227
$command = $db->createCommand();
228-
$mb = $db->getMigrationBuilder();
229228

230229
$expected = <<<SQL
231230
CREATE TABLE [test_table] (
@@ -240,14 +239,14 @@ public function testCreateTable(): void
240239
) CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB
241240
SQL;
242241
$columns = [
243-
'id' => $mb->primaryKey(5),
244-
'name' => $mb->string(255)->notNull(),
245-
'email' => $mb->string(255)->notNull(),
246-
'address' => $mb->string(255)->notNull(),
247-
'status' => $mb->integer()->notNull(),
248-
'profile_id' => $mb->integer()->notNull(),
249-
'created_at' => $mb->timestamp()->notNull(),
250-
'updated_at' => $mb->timestamp()->notNull(),
242+
'id' => SchemaInterface::TYPE_PK,
243+
'name' => SchemaInterface::TYPE_STRING . '(255) NOT NULL',
244+
'email' => SchemaInterface::TYPE_STRING . '(255) NOT NULL',
245+
'address' => SchemaInterface::TYPE_STRING . '(255) NOT NULL',
246+
'status' => SchemaInterface::TYPE_INTEGER . ' NOT NULL',
247+
'profile_id' => SchemaInterface::TYPE_INTEGER . ' NOT NULL',
248+
'created_at' => SchemaInterface::TYPE_TIMESTAMP . ' NOT NULL',
249+
'updated_at' => SchemaInterface::TYPE_TIMESTAMP . ' NOT NULL',
251250
];
252251
$options = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
253252
$sql = $command->createTable('test_table', $columns, $options)->getSql();

0 commit comments

Comments
 (0)