Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit d4f6f2d

Browse files
committed
Adjust tests for enum with table name
1 parent d4527f5 commit d4f6f2d

13 files changed

+51
-51
lines changed

tests/specs/blog_v2/migrations_pgsql_db/m200000_000000_change_table_v2_posts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class m200000_000000_change_table_v2_posts extends \yii\db\Migration
88
public function safeUp()
99
{
1010
$this->addColumn('{{%v2_posts}}', 'id', $this->bigPrimaryKey());
11-
$this->execute('CREATE TYPE "enum_lang" AS ENUM(\'ru\', \'eng\')');
12-
$this->addColumn('{{%v2_posts}}', 'lang', 'enum_lang NULL DEFAULT \'ru\'');
11+
$this->execute('CREATE TYPE "enum_itt_v2_posts_lang" AS ENUM(\'ru\', \'eng\')');
12+
$this->addColumn('{{%v2_posts}}', 'lang', 'enum_itt_v2_posts_lang NULL DEFAULT \'ru\'');
1313
$this->dropColumn('{{%v2_posts}}', 'uid');
1414
$this->alterColumn('{{%v2_posts}}', 'active', "DROP DEFAULT");
1515
$this->alterColumn('{{%v2_posts}}', 'category_id', 'bigint NOT NULL USING "category_id"::bigint');
@@ -25,7 +25,7 @@ public function safeDown()
2525
$this->addColumn('{{%v2_posts}}', 'uid', $this->bigInteger()->notNull());
2626
$this->dropColumn('{{%v2_posts}}', 'lang');
2727
$this->dropColumn('{{%v2_posts}}', 'id');
28-
$this->execute('DROP TYPE "enum_lang"');
28+
$this->execute('DROP TYPE "enum_itt_v2_posts_lang"');
2929
$this->alterColumn('{{%v2_posts}}', 'active', "SET DEFAULT 'f'");
3030
}
3131
}

tests/specs/blog_v2/migrations_pgsql_db/m200000_000001_create_table_v2_tags.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ class m200000_000001_create_table_v2_tags extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_lang" AS ENUM(\'ru\', \'eng\')');
10+
$this->execute('CREATE TYPE "enum_itt_v2_tags_lang" AS ENUM(\'ru\', \'eng\')');
1111
$this->createTable('{{%v2_tags}}', [
1212
'id' => $this->bigPrimaryKey(),
1313
0 => '"name" varchar(100) NOT NULL',
14-
'lang' => 'enum_lang NOT NULL',
14+
'lang' => 'enum_itt_v2_tags_lang NOT NULL',
1515
]);
1616
$this->createIndex('v2_tags_name_key', '{{%v2_tags}}', 'name', true);
1717
}
@@ -20,6 +20,6 @@ public function safeDown()
2020
{
2121
$this->dropIndex('v2_tags_name_key', '{{%v2_tags}}');
2222
$this->dropTable('{{%v2_tags}}');
23-
$this->execute('DROP TYPE "enum_lang"');
23+
$this->execute('DROP TYPE "enum_itt_v2_tags_lang"');
2424
}
2525
}

tests/specs/blog_v2/migrations_pgsql_db/m200000_000004_change_table_v2_users.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ class m200000_000004_change_table_v2_users extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_role" AS ENUM(\'admin\', \'editor\', \'reader\')');
10+
$this->execute('CREATE TYPE "enum_itt_v2_users_role" AS ENUM(\'admin\', \'editor\', \'reader\')');
1111
$this->addColumn('{{%v2_users}}', 'login', $this->text()->notNull());
1212
$this->dropColumn('{{%v2_users}}', 'username');
1313
$this->alterColumn('{{%v2_users}}', 'created_at', "DROP DEFAULT");
1414
$this->db->createCommand('ALTER TABLE {{%v2_users}} ALTER COLUMN "email" SET DATA TYPE varchar(255)')->execute();
15-
$this->alterColumn('{{%v2_users}}', 'role', 'enum_role USING "role"::"enum_role"');
15+
$this->alterColumn('{{%v2_users}}', 'role', 'enum_itt_v2_users_role USING "role"::"enum_itt_v2_users_role"');
1616
$this->alterColumn('{{%v2_users}}', 'role', "DROP DEFAULT");
1717
$this->dropIndex('v2_users_username_key', '{{%v2_users}}');
1818
$this->createIndex('v2_users_login_key', '{{%v2_users}}', 'login', true);
@@ -30,6 +30,6 @@ public function safeDown()
3030
$this->dropColumn('{{%v2_users}}', 'login');
3131
$this->alterColumn('{{%v2_users}}', 'created_at', "SET DEFAULT CURRENT_TIMESTAMP");
3232
$this->alterColumn('{{%v2_users}}', 'role', "SET DEFAULT 'reader'");
33-
$this->execute('DROP TYPE "enum_role"');
33+
$this->execute('DROP TYPE "enum_itt_v2_users_role"');
3434
}
3535
}

tests/specs/enum/change/pgsql/app/migrations_pgsql_db/m200000_000000_change_table_editcolumns.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ class m200000_000000_change_table_editcolumns extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_connection" AS ENUM(\'WIRED\', \'WIRELESS\')');
11-
$this->alterColumn('{{%editcolumns}}', 'connection', 'enum_connection USING "connection"::"enum_connection"');
10+
$this->execute('CREATE TYPE "enum_itt_editcolumns_connection" AS ENUM(\'WIRED\', \'WIRELESS\')');
11+
$this->alterColumn('{{%editcolumns}}', 'connection', 'enum_itt_editcolumns_connection USING "connection"::"enum_itt_editcolumns_connection"');
1212
$this->alterColumn('{{%editcolumns}}', 'connection', "SET NOT NULL");
1313
$this->alterColumn('{{%editcolumns}}', 'connection', "SET DEFAULT 'WIRED'");
1414
$this->alterColumn('{{%editcolumns}}', 'device', 'text NULL USING "device"::text');
1515
$this->alterColumn('{{%editcolumns}}', 'device', "DROP NOT NULL");
1616
$this->alterColumn('{{%editcolumns}}', 'device', "DROP DEFAULT");
17-
$this->execute('DROP TYPE "enum_device"');
17+
$this->execute('DROP TYPE "enum_itt_editcolumns_device"');
1818
}
1919

2020
public function safeDown()
2121
{
22-
$this->execute('CREATE TYPE "enum_device" AS ENUM(\'MOBILE\', \'TV\', \'COMPUTER\')');
23-
$this->alterColumn('{{%editcolumns}}', 'device', 'enum_device USING "device"::"enum_device"');
22+
$this->execute('CREATE TYPE "enum_itt_editcolumns_device" AS ENUM(\'MOBILE\', \'TV\', \'COMPUTER\')');
23+
$this->alterColumn('{{%editcolumns}}', 'device', 'enum_itt_editcolumns_device USING "device"::"enum_itt_editcolumns_device"');
2424
$this->alterColumn('{{%editcolumns}}', 'connection', 'varchar(255) NULL USING "connection"::varchar');
2525
$this->alterColumn('{{%editcolumns}}', 'connection', "DROP NOT NULL");
2626
$this->alterColumn('{{%editcolumns}}', 'connection', "DROP DEFAULT");
27-
$this->execute('DROP TYPE "enum_connection"');
27+
$this->execute('DROP TYPE "enum_itt_editcolumns_connection"');
2828
$this->alterColumn('{{%editcolumns}}', 'device', "SET NOT NULL");
2929
$this->alterColumn('{{%editcolumns}}', 'device', "SET DEFAULT 'TV'");
3030
}

tests/specs/enum/change/pgsql/app/migrations_pgsql_db/m200000_000001_create_table_newcolumns.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ class m200000_000001_create_table_newcolumns extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_new_column" AS ENUM(\'ONE\', \'TWO\', \'THREE\')');
10+
$this->execute('CREATE TYPE "enum_itt_newcolumns_new_column" AS ENUM(\'ONE\', \'TWO\', \'THREE\')');
1111
$this->createTable('{{%newcolumns}}', [
1212
'id' => $this->primaryKey(),
13-
'new_column' => 'enum_new_column NOT NULL DEFAULT \'ONE\'',
13+
'new_column' => 'enum_itt_newcolumns_new_column NOT NULL DEFAULT \'ONE\'',
1414
]);
1515
}
1616

1717
public function safeDown()
1818
{
1919
$this->dropTable('{{%newcolumns}}');
20-
$this->execute('DROP TYPE "enum_new_column"');
20+
$this->execute('DROP TYPE "enum_itt_newcolumns_new_column"');
2121
}
2222
}

tests/specs/enum/change/pgsql/app/migrations_pgsql_db/m200000_000002_create_table_pristines.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ class m200000_000002_create_table_pristines extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_device" AS ENUM(\'MOBILE\', \'TV\', \'COMPUTER\')');
10+
$this->execute('CREATE TYPE "enum_itt_pristines_device" AS ENUM(\'MOBILE\', \'TV\', \'COMPUTER\')');
1111
$this->createTable('{{%pristines}}', [
1212
'id' => $this->primaryKey(),
13-
'device' => 'enum_device NOT NULL DEFAULT \'TV\'',
13+
'device' => 'enum_itt_pristines_device NOT NULL DEFAULT \'TV\'',
1414
]);
1515
}
1616

1717
public function safeDown()
1818
{
1919
$this->dropTable('{{%pristines}}');
20-
$this->execute('DROP TYPE "enum_device"');
20+
$this->execute('DROP TYPE "enum_itt_pristines_device"');
2121
}
2222
}

tests/specs/enum/fresh/pgsql/app/migrations_pgsql_db/m200000_000000_create_table_editcolumns.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ class m200000_000000_create_table_editcolumns extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_connection" AS ENUM(\'WIRED\', \'WIRELESS\')');
10+
$this->execute('CREATE TYPE "enum_itt_editcolumns_connection" AS ENUM(\'WIRED\', \'WIRELESS\')');
1111
$this->createTable('{{%editcolumns}}', [
1212
'id' => $this->primaryKey(),
1313
'device' => $this->text()->null()->defaultValue(null),
14-
'connection' => 'enum_connection NOT NULL DEFAULT \'WIRED\'',
14+
'connection' => 'enum_itt_editcolumns_connection NOT NULL DEFAULT \'WIRED\'',
1515
]);
1616
}
1717

1818
public function safeDown()
1919
{
2020
$this->dropTable('{{%editcolumns}}');
21-
$this->execute('DROP TYPE "enum_connection"');
21+
$this->execute('DROP TYPE "enum_itt_editcolumns_connection"');
2222
}
2323
}

tests/specs/enum/fresh/pgsql/app/migrations_pgsql_db/m200000_000001_create_table_newcolumns.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ class m200000_000001_create_table_newcolumns extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_new_column" AS ENUM(\'ONE\', \'TWO\', \'THREE\')');
10+
$this->execute('CREATE TYPE "enum_itt_newcolumns_new_column" AS ENUM(\'ONE\', \'TWO\', \'THREE\')');
1111
$this->createTable('{{%newcolumns}}', [
1212
'id' => $this->primaryKey(),
13-
'new_column' => 'enum_new_column NOT NULL DEFAULT \'ONE\'',
13+
'new_column' => 'enum_itt_newcolumns_new_column NOT NULL DEFAULT \'ONE\'',
1414
]);
1515
}
1616

1717
public function safeDown()
1818
{
1919
$this->dropTable('{{%newcolumns}}');
20-
$this->execute('DROP TYPE "enum_new_column"');
20+
$this->execute('DROP TYPE "enum_itt_newcolumns_new_column"');
2121
}
2222
}

tests/specs/enum/fresh/pgsql/app/migrations_pgsql_db/m200000_000002_create_table_pristines.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ class m200000_000002_create_table_pristines extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_device" AS ENUM(\'MOBILE\', \'TV\', \'COMPUTER\')');
10+
$this->execute('CREATE TYPE "enum_itt_pristines_device" AS ENUM(\'MOBILE\', \'TV\', \'COMPUTER\')');
1111
$this->createTable('{{%pristines}}', [
1212
'id' => $this->primaryKey(),
13-
'device' => 'enum_device NOT NULL DEFAULT \'TV\'',
13+
'device' => 'enum_itt_pristines_device NOT NULL DEFAULT \'TV\'',
1414
]);
1515
}
1616

1717
public function safeDown()
1818
{
1919
$this->dropTable('{{%pristines}}');
20-
$this->execute('DROP TYPE "enum_device"');
20+
$this->execute('DROP TYPE "enum_itt_pristines_device"');
2121
}
2222
}

tests/specs/enum/new_column/pgsql/app/migrations_pgsql_db/m200000_000000_create_table_editcolumns.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ class m200000_000000_create_table_editcolumns extends \yii\db\Migration
77
{
88
public function safeUp()
99
{
10-
$this->execute('CREATE TYPE "enum_connection" AS ENUM(\'WIRED\', \'WIRELESS\')');
10+
$this->execute('CREATE TYPE "enum_itt_editcolumns_connection" AS ENUM(\'WIRED\', \'WIRELESS\')');
1111
$this->createTable('{{%editcolumns}}', [
1212
'id' => $this->primaryKey(),
1313
'device' => $this->text()->null()->defaultValue(null),
14-
'connection' => 'enum_connection NOT NULL DEFAULT \'WIRED\'',
14+
'connection' => 'enum_itt_editcolumns_connection NOT NULL DEFAULT \'WIRED\'',
1515
]);
1616
}
1717

1818
public function safeDown()
1919
{
2020
$this->dropTable('{{%editcolumns}}');
21-
$this->execute('DROP TYPE "enum_connection"');
21+
$this->execute('DROP TYPE "enum_itt_editcolumns_connection"');
2222
}
2323
}

0 commit comments

Comments
 (0)