Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
7babecd
Fix-xDbType
siggi-k Jul 6, 2022
a934859
Fix-Nullable (#99)
siggi-k Jul 7, 2022
5870b24
Update README.md
cebe Jul 7, 2022
7754878
Fix-Enum on MariaDb
siggi-k Jul 12, 2022
304cf15
Merge branch 'fix-db-schema' of github.com:siggi-k/yii2-openapi into …
siggi-k Jul 12, 2022
6ae03fb
Fix-numeric (mariaDb)
siggi-k Aug 25, 2022
b92a2ab
test
SOHELAHMED7 Sep 30, 2022
2a7e053
Undo test
SOHELAHMED7 Sep 30, 2022
f12b01c
test
SOHELAHMED7 Sep 30, 2022
d177ed9
Undo test
SOHELAHMED7 Sep 30, 2022
314743e
test2
SOHELAHMED7 Oct 3, 2022
3184ae0
Merge branch '100-timestamp-migrations-do-not-work-in-mariadb' of git…
SOHELAHMED7 Oct 3, 2022
2af51fb
Undo test2
SOHELAHMED7 Oct 3, 2022
96b91b1
Simplify condition
SOHELAHMED7 Oct 3, 2022
2697fe8
Update fixture
SOHELAHMED7 Oct 4, 2022
73fd187
Enhancements
SOHELAHMED7 Oct 4, 2022
0fda678
Fix failing tests
SOHELAHMED7 Oct 4, 2022
540e9ff
Fix style
SOHELAHMED7 Oct 4, 2022
c9aeee7
test
SOHELAHMED7 Nov 2, 2022
fdfe048
undo test
SOHELAHMED7 Nov 2, 2022
3740d5b
Add composer package sam-it/yii2-mariadb
SOHELAHMED7 Nov 2, 2022
4a313cc
Remove enum as there is not enum physical type in \yii\db\pgsql\Schema
SOHELAHMED7 Nov 2, 2022
e0b8e00
Fix error in tests: Remove enum as there is not enum physical type in…
SOHELAHMED7 Nov 2, 2022
1b9f568
Fix errors in tests, fix fixtures, fix mariadb docker image; fix mari…
SOHELAHMED7 Nov 2, 2022
8fb7084
test
SOHELAHMED7 Nov 21, 2022
329866e
undo test
SOHELAHMED7 Nov 21, 2022
58e5772
Merge branches 'master' and '100-timestamp-migrations-do-not-work-in-…
SOHELAHMED7 Nov 21, 2022
4654195
Remove 'without UUID' test case
SOHELAHMED7 Nov 21, 2022
da85359
Remove 'without UUID' test case part 2
SOHELAHMED7 Nov 21, 2022
0b94b2a
Add TODO note [skip ci]
SOHELAHMED7 Nov 21, 2022
99433e1
Remove UUID in tests [skip ci]
SOHELAHMED7 Nov 22, 2022
ee5136c
Convert erroneous tests to failed tests
SOHELAHMED7 Nov 22, 2022
b667ac0
Use real app and real DB everywhere
SOHELAHMED7 Nov 22, 2022
930e39e
Edit GA to Run tests in Docker container in Github action
SOHELAHMED7 Nov 22, 2022
5a3395c
Change vendor of install-docker-compose in GA
SOHELAHMED7 Nov 22, 2022
bf0c9a7
Config GA - WIP
SOHELAHMED7 Nov 22, 2022
1924510
Config GA -part 2 - WIP
SOHELAHMED7 Nov 22, 2022
b4ec082
Config GA -part 3 - WIP
SOHELAHMED7 Nov 22, 2022
95dee95
Config GA -part 4 - WIP
SOHELAHMED7 Nov 22, 2022
a705c84
Config GA -part 5 - WIP
SOHELAHMED7 Nov 22, 2022
e9dea60
Config GA -part 6 - WIP
SOHELAHMED7 Nov 22, 2022
bfa65e2
Config GA -part 7 - WIP
SOHELAHMED7 Nov 22, 2022
17781a8
Fix failing tests and add more tests for Pgsql and Mariadb
SOHELAHMED7 Nov 22, 2022
e4e2488
Fix failing tests and bugs
SOHELAHMED7 Nov 23, 2022
a753d91
Fix enum related bug in failing tests - WIP
SOHELAHMED7 Nov 23, 2022
64b6936
WIP
SOHELAHMED7 Nov 23, 2022
6adae6a
Remove all enum related changes
SOHELAHMED7 Nov 25, 2022
015a1fc
Add TODO in Makefile
SOHELAHMED7 Nov 25, 2022
0a79006
Fix failing tests
SOHELAHMED7 Nov 25, 2022
68718e0
Attempt to fix failing tests in GA
SOHELAHMED7 Nov 25, 2022
f2cacfe
Error message betterment
SOHELAHMED7 Nov 25, 2022
4868df0
last commit ('Error message betterment') didn't seen in Github, check…
SOHELAHMED7 Nov 25, 2022
b32ae65
BLOB, TEXT, GEOMETRY, and JSON data types cannot be assigned a defaul…
SOHELAHMED7 Nov 26, 2022
a3929f0
Fix failing tests caused by x-db-type implementation and running test…
SOHELAHMED7 Nov 26, 2022
54da89a
Cleanup
SOHELAHMED7 Nov 26, 2022
1516dd6
Cleanup 2
SOHELAHMED7 Nov 27, 2022
e8ae746
Fix bug in x-db-type feature + Add tests WIP
SOHELAHMED7 Nov 28, 2022
dbe2ba5
Fix failing test
SOHELAHMED7 Nov 28, 2022
22e3ace
Restructure base DbTestCase and organize tests
SOHELAHMED7 Nov 28, 2022
2f010bf
Add tests for x-db-type for MySQL, MariaDb and PgSQL for cases: fresh…
SOHELAHMED7 Nov 29, 2022
df929e0
Fix failing tests + add change column data type by x-db-type - WIP
SOHELAHMED7 Nov 30, 2022
15b1b68
Trigger Github Action
SOHELAHMED7 Nov 30, 2022
8feea61
Trigger Github Action 2
SOHELAHMED7 Nov 30, 2022
3085986
Trigger Github Action 3
SOHELAHMED7 Nov 30, 2022
9953ede
Trigger Github Action 4
SOHELAHMED7 Nov 30, 2022
632dcb8
Enh Github Action
SOHELAHMED7 Dec 1, 2022
44af514
Fix issue and failing test in implementation of x-db-type
SOHELAHMED7 Dec 1, 2022
109e46d
Enhance tests + organize code
SOHELAHMED7 Dec 2, 2022
5cc77ea
Change PropertySchema
SOHELAHMED7 Dec 2, 2022
fec8a0b
Consider phpType in comparison
SOHELAHMED7 Dec 2, 2022
c3c5367
Strengthen the way tmp column is stored for compareColumn part + fix …
SOHELAHMED7 Dec 3, 2022
7928ef0
Fix style + Implement Pgsql compare column change by new way
SOHELAHMED7 Dec 3, 2022
ac42564
Fix bugs in Decimal related x-db-type changes
SOHELAHMED7 Dec 5, 2022
6e2275d
Refactor migration generation code and add more tests for x-db-type f…
SOHELAHMED7 Dec 6, 2022
fb869ba
Add more tests for x-db-type for MySQL
SOHELAHMED7 Dec 6, 2022
dd0ce9b
Add more tests
SOHELAHMED7 Dec 7, 2022
2180f7a
Add more tests for edit column scenario
SOHELAHMED7 Dec 8, 2022
6a3e1da
Pass the CI
SOHELAHMED7 Dec 8, 2022
30671aa
Add tests for Mariadb + add tooling support to run migrations for mul…
SOHELAHMED7 Dec 8, 2022
d5d0f6f
Fix bug related to DB type with more than one word for MySQL and PgSQ…
SOHELAHMED7 Dec 12, 2022
02d06fa
Tests refactoring and add more x-db-type tests for PgSQL
SOHELAHMED7 Dec 13, 2022
4fb7b28
WIP
SOHELAHMED7 Dec 13, 2022
8449d44
Implement string base add column code - WIP ('double precision precis…
SOHELAHMED7 Dec 13, 2022
2baf6c5
Fix 'double precision precision' issue for x-db-type - WIP + Fix few …
SOHELAHMED7 Dec 14, 2022
3ac7837
Fix failing tests
SOHELAHMED7 Dec 14, 2022
7df1b85
Delete un-necessary file
SOHELAHMED7 Dec 14, 2022
b1cf636
Change addColumn feature in migration for x-db-type
SOHELAHMED7 Dec 17, 2022
8d19fe9
Fix issue for alter column for x-db-type in Pgsql
SOHELAHMED7 Dec 19, 2022
7f64da0
Fix style
SOHELAHMED7 Dec 19, 2022
477c38b
Fix tests for fresh tables scenario
SOHELAHMED7 Dec 19, 2022
0070b63
Enhance PR
SOHELAHMED7 Dec 20, 2022
595f25f
Add more tests
SOHELAHMED7 Dec 20, 2022
cbd1dc1
Enhance PR
SOHELAHMED7 Dec 20, 2022
a49eee1
Fix bugs + add more tests
SOHELAHMED7 Dec 20, 2022
984382f
Add docs
SOHELAHMED7 Dec 20, 2022
a00a8da
Fix failing test
SOHELAHMED7 Dec 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix bugs + add more tests
  • Loading branch information
SOHELAHMED7 committed Dec 20, 2022
commit a49eee1654e1d5c0ac0b01a855956c586dd6d217
6 changes: 3 additions & 3 deletions src/lib/migrations/MigrationRecordBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ final class MigrationRecordBuilder
public const ADD_PK = MigrationRecordBuilder::INDENT . "\$this->addPrimaryKey('%s', '%s', '%s');";
public const ADD_COLUMN = MigrationRecordBuilder::INDENT . "\$this->addColumn('%s', '%s', %s);";

public const ADD_COLUMN_RAW = MigrationRecordBuilder::INDENT . "\$this->db->createCommand(\"ALTER TABLE %s ADD COLUMN %s %s\")->execute();";
public const ADD_COLUMN_RAW = MigrationRecordBuilder::INDENT . "\$this->db->createCommand('ALTER TABLE %s ADD COLUMN %s %s')->execute();";

public const ALTER_COLUMN = MigrationRecordBuilder::INDENT . "\$this->alterColumn('%s', '%s', %s);";

public const ALTER_COLUMN_RAW = MigrationRecordBuilder::INDENT . "\$this->db->createCommand(\"ALTER TABLE %s MODIFY %s %s\")->execute();";
public const ALTER_COLUMN_RAW_PGSQL = MigrationRecordBuilder::INDENT . "\$this->db->createCommand(\"ALTER TABLE %s ALTER COLUMN %s SET DATA TYPE %s\")->execute();";
public const ALTER_COLUMN_RAW = MigrationRecordBuilder::INDENT . "\$this->db->createCommand('ALTER TABLE %s MODIFY %s %s')->execute();";
public const ALTER_COLUMN_RAW_PGSQL = MigrationRecordBuilder::INDENT . "\$this->db->createCommand('ALTER TABLE %s ALTER COLUMN %s SET DATA TYPE %s')->execute();";

/**
* @var \yii\db\Schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class m200000_000001_change_table_editcolumns extends \yii\db\Migration
{
public function up()
{
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN first_name varchar(255) NULL DEFAULT NULL")->execute();
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n json NOT NULL DEFAULT \'[]\'")->execute();
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n_2 json NOT NULL DEFAULT \'[]\'")->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN first_name varchar(255) NULL DEFAULT NULL')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n json NOT NULL DEFAULT \'[]\'')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n_2 json NOT NULL DEFAULT \'[]\'')->execute();
$this->alterColumn('{{%editcolumns}}', 'dec_col', $this->decimal(12,2)->null()->defaultValue("3.14"));
$this->alterColumn('{{%editcolumns}}', 'json_col', $this->text()->notNull()->defaultValue("fox jumps over dog"));
$this->alterColumn('{{%editcolumns}}', 'json_col_2', 'json NOT NULL DEFAULT \'[]\'');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class m200000_000001_change_table_editcolumns extends \yii\db\Migration
{
public function up()
{
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN first_name varchar(255) NULL DEFAULT NULL")->execute();
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n json NOT NULL")->execute();
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n_2 json NOT NULL")->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN first_name varchar(255) NULL DEFAULT NULL')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n json NOT NULL')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n_2 json NOT NULL')->execute();
$this->alterColumn('{{%editcolumns}}', 'dec_col', $this->decimal(12,2)->null()->defaultValue("3.14"));
$this->alterColumn('{{%editcolumns}}', 'json_col', $this->text()->notNull());
$this->alterColumn('{{%editcolumns}}', 'json_col_2', 'json NOT NULL');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,95 +12,96 @@ public function safeUp()
0 => 'string_col varchar NULL DEFAULT NULL',
1 => 'varchar_col varchar NULL DEFAULT NULL',
2 => 'text_col text NULL DEFAULT NULL',
3 => 'varchar_4_col varchar(4) NULL DEFAULT NULL',
4 => 'varchar_5_col varchar(5) NULL DEFAULT NULL',
5 => 'char_4_col char(4) NULL DEFAULT NULL',
6 => 'char_5_col char NULL DEFAULT NULL',
7 => 'char_6_col char NOT NULL',
8 => 'char_7_col char(6) NOT NULL',
9 => 'char_8_col char NULL DEFAULT \'d\'',
10 => 'decimal_col decimal(12,3) NULL DEFAULT NULL',
11 => 'bytea_col_2 bytea NULL DEFAULT NULL',
12 => 'bit_col bit NULL DEFAULT NULL',
13 => 'bit_2 bit(1) NULL DEFAULT NULL',
14 => 'bit_3 bit(64) NULL DEFAULT NULL',
15 => 'ti smallint NULL DEFAULT NULL',
16 => 'int2_col int2 NULL DEFAULT NULL',
17 => 'smallserial_col smallserial NOT NULL',
18 => 'serial2_col serial2 NOT NULL',
19 => 'si_col smallint NULL DEFAULT NULL',
20 => 'si_col_2 smallint NULL DEFAULT NULL',
21 => 'bi bigint NULL DEFAULT NULL',
22 => 'bi2 int8 NULL DEFAULT NULL',
23 => 'int4_col int4 NULL DEFAULT NULL',
24 => 'bigserial_col bigserial NOT NULL',
25 => 'bigserial_col_2 serial8 NOT NULL',
26 => 'int_col int NULL DEFAULT NULL',
27 => 'int_col_2 integer NULL DEFAULT NULL',
28 => 'numeric_col numeric NULL DEFAULT NULL',
29 => 'numeric_col_2 numeric(10) NULL DEFAULT NULL',
30 => 'numeric_col_3 numeric(10,2) NULL DEFAULT NULL',
31 => 'double_p_2 double precision NULL DEFAULT NULL',
32 => 'double_p_3 double precision NULL DEFAULT NULL',
33 => 'real_col real NULL DEFAULT NULL',
34 => 'float4_col float4 NULL DEFAULT NULL',
35 => 'date_col date NULL DEFAULT NULL',
36 => 'time_col time NULL DEFAULT NULL',
37 => 'time_col_2 time with time zone NULL DEFAULT NULL',
38 => 'time_col_3 time without time zone NULL DEFAULT NULL',
39 => 'time_col_4 time(3) without time zone NULL DEFAULT NULL',
40 => 'timetz_col timetz NULL DEFAULT NULL',
41 => 'timetz_col_2 timetz(3) NULL DEFAULT NULL',
42 => 'timestamp_col timestamp NULL DEFAULT NULL',
43 => 'timestamp_col_2 timestamp with time zone NULL DEFAULT NULL',
44 => 'timestamp_col_3 timestamp without time zone NULL DEFAULT NULL',
45 => 'timestamp_col_4 timestamp(3) without time zone NULL DEFAULT NULL',
46 => 'timestamptz_col timestamptz NULL DEFAULT NULL',
47 => 'timestamptz_col_2 timestamptz(3) NULL DEFAULT NULL',
48 => 'date2 date NULL DEFAULT NULL',
49 => 'timestamp_col_z timestamp NULL DEFAULT NULL',
50 => 'bit_varying bit varying NULL DEFAULT NULL',
51 => 'bit_varying_n bit varying(8) NULL DEFAULT NULL',
52 => 'bit_varying_n_2 varbit NULL DEFAULT NULL',
53 => 'bit_varying_n_3 varbit(3) NULL DEFAULT NULL',
54 => 'bool_col boolean NULL DEFAULT NULL',
55 => 'bool_col_2 bool NULL DEFAULT NULL',
56 => 'box_col box NULL DEFAULT NULL',
57 => 'character_col character NULL DEFAULT NULL',
58 => 'character_n character(12) NULL DEFAULT NULL',
59 => 'character_varying character varying NULL DEFAULT NULL',
60 => 'character_varying_n character varying(12) NULL DEFAULT NULL',
61 => 'json_col json NOT NULL',
62 => 'jsonb_col jsonb NOT NULL',
63 => 'json_col_def json NOT NULL DEFAULT \'[]\'',
64 => 'json_col_def_2 json NOT NULL DEFAULT \'[]\'',
65 => 'bytea_def bytea NULL DEFAULT \'the bytea blob default\'',
66 => 'text_def text NULL DEFAULT \'the text\'',
67 => 'json_def json NOT NULL DEFAULT \'{"a":"b"}\'',
68 => 'jsonb_def jsonb NOT NULL DEFAULT \'{"ba":"bb"}\'',
69 => 'cidr_col cidr NULL DEFAULT NULL',
70 => 'circle_col circle NULL DEFAULT NULL',
71 => 'date_col_z date NULL DEFAULT NULL',
72 => 'float8_col float8 NULL DEFAULT NULL',
73 => 'inet_col inet NULL DEFAULT NULL',
74 => 'interval_col interval NULL DEFAULT NULL',
75 => 'interval_col_2 interval year NULL DEFAULT NULL',
76 => 'interval_col_3 interval day to second(3) NULL DEFAULT NULL',
77 => 'line_col line NULL DEFAULT NULL',
78 => 'lseg_col lseg NULL DEFAULT NULL',
79 => 'macaddr_col macaddr NULL DEFAULT NULL',
80 => 'money_col money NULL DEFAULT NULL',
81 => 'path_col path NULL DEFAULT NULL',
82 => 'pg_lsn_col pg_lsn NULL DEFAULT NULL',
83 => 'point_col point NULL DEFAULT NULL',
84 => 'polygon_col polygon NULL DEFAULT NULL',
85 => 'serial_col serial NOT NULL',
86 => 'serial4_col serial4 NOT NULL',
87 => 'tsquery_col tsquery NULL DEFAULT NULL',
88 => 'tsvector_col tsvector NULL',
89 => 'txid_snapshot_col txid_snapshot NULL DEFAULT NULL',
90 => 'uuid_col uuid NULL DEFAULT NULL',
91 => 'xml_col xml NULL DEFAULT NULL',
3 => 'text_col_array text[] NULL DEFAULT NULL',
4 => 'varchar_4_col varchar(4) NULL DEFAULT NULL',
5 => 'varchar_5_col varchar(5) NULL DEFAULT NULL',
6 => 'char_4_col char(4) NULL DEFAULT NULL',
7 => 'char_5_col char NULL DEFAULT NULL',
8 => 'char_6_col char NOT NULL',
9 => 'char_7_col char(6) NOT NULL',
10 => 'char_8_col char NULL DEFAULT \'d\'',
11 => 'decimal_col decimal(12,3) NULL DEFAULT NULL',
12 => 'bytea_col_2 bytea NULL DEFAULT NULL',
13 => 'bit_col bit NULL DEFAULT NULL',
14 => 'bit_2 bit(1) NULL DEFAULT NULL',
15 => 'bit_3 bit(64) NULL DEFAULT NULL',
16 => 'ti smallint NULL DEFAULT NULL',
17 => 'int2_col int2 NULL DEFAULT NULL',
18 => 'smallserial_col smallserial NOT NULL',
19 => 'serial2_col serial2 NOT NULL',
20 => 'si_col smallint NULL DEFAULT NULL',
21 => 'si_col_2 smallint NULL DEFAULT NULL',
22 => 'bi bigint NULL DEFAULT NULL',
23 => 'bi2 int8 NULL DEFAULT NULL',
24 => 'int4_col int4 NULL DEFAULT NULL',
25 => 'bigserial_col bigserial NOT NULL',
26 => 'bigserial_col_2 serial8 NOT NULL',
27 => 'int_col int NULL DEFAULT NULL',
28 => 'int_col_2 integer NULL DEFAULT NULL',
29 => 'numeric_col numeric NULL DEFAULT NULL',
30 => 'numeric_col_2 numeric(10) NULL DEFAULT NULL',
31 => 'numeric_col_3 numeric(10,2) NULL DEFAULT NULL',
32 => 'double_p_2 double precision NULL DEFAULT NULL',
33 => 'double_p_3 double precision NULL DEFAULT NULL',
34 => 'real_col real NULL DEFAULT NULL',
35 => 'float4_col float4 NULL DEFAULT NULL',
36 => 'date_col date NULL DEFAULT NULL',
37 => 'time_col time NULL DEFAULT NULL',
38 => 'time_col_2 time with time zone NULL DEFAULT NULL',
39 => 'time_col_3 time without time zone NULL DEFAULT NULL',
40 => 'time_col_4 time(3) without time zone NULL DEFAULT NULL',
41 => 'timetz_col timetz NULL DEFAULT NULL',
42 => 'timetz_col_2 timetz(3) NULL DEFAULT NULL',
43 => 'timestamp_col timestamp NULL DEFAULT NULL',
44 => 'timestamp_col_2 timestamp with time zone NULL DEFAULT NULL',
45 => 'timestamp_col_3 timestamp without time zone NULL DEFAULT NULL',
46 => 'timestamp_col_4 timestamp(3) without time zone NULL DEFAULT NULL',
47 => 'timestamptz_col timestamptz NULL DEFAULT NULL',
48 => 'timestamptz_col_2 timestamptz(3) NULL DEFAULT NULL',
49 => 'date2 date NULL DEFAULT NULL',
50 => 'timestamp_col_z timestamp NULL DEFAULT NULL',
51 => 'bit_varying bit varying NULL DEFAULT NULL',
52 => 'bit_varying_n bit varying(8) NULL DEFAULT NULL',
53 => 'bit_varying_n_2 varbit NULL DEFAULT NULL',
54 => 'bit_varying_n_3 varbit(3) NULL DEFAULT NULL',
55 => 'bool_col boolean NULL DEFAULT NULL',
56 => 'bool_col_2 bool NULL DEFAULT NULL',
57 => 'box_col box NULL DEFAULT NULL',
58 => 'character_col character NULL DEFAULT NULL',
59 => 'character_n character(12) NULL DEFAULT NULL',
60 => 'character_varying character varying NULL DEFAULT NULL',
61 => 'character_varying_n character varying(12) NULL DEFAULT NULL',
62 => 'json_col json NOT NULL',
63 => 'jsonb_col jsonb NOT NULL',
64 => 'json_col_def json NOT NULL DEFAULT \'[]\'',
65 => 'json_col_def_2 json NOT NULL DEFAULT \'[]\'',
66 => 'bytea_def bytea NULL DEFAULT \'the bytea blob default\'',
67 => 'text_def text NULL DEFAULT \'the text\'',
68 => 'json_def json NOT NULL DEFAULT \'{"a":"b"}\'',
69 => 'jsonb_def jsonb NOT NULL DEFAULT \'{"ba":"bb"}\'',
70 => 'cidr_col cidr NULL DEFAULT NULL',
71 => 'circle_col circle NULL DEFAULT NULL',
72 => 'date_col_z date NULL DEFAULT NULL',
73 => 'float8_col float8 NULL DEFAULT NULL',
74 => 'inet_col inet NULL DEFAULT NULL',
75 => 'interval_col interval NULL DEFAULT NULL',
76 => 'interval_col_2 interval year NULL DEFAULT NULL',
77 => 'interval_col_3 interval day to second(3) NULL DEFAULT NULL',
78 => 'line_col line NULL DEFAULT NULL',
79 => 'lseg_col lseg NULL DEFAULT NULL',
80 => 'macaddr_col macaddr NULL DEFAULT NULL',
81 => 'money_col money NULL DEFAULT NULL',
82 => 'path_col path NULL DEFAULT NULL',
83 => 'pg_lsn_col pg_lsn NULL DEFAULT NULL',
84 => 'point_col point NULL DEFAULT NULL',
85 => 'polygon_col polygon NULL DEFAULT NULL',
86 => 'serial_col serial NOT NULL',
87 => 'serial4_col serial4 NOT NULL',
88 => 'tsquery_col tsquery NULL DEFAULT NULL',
89 => 'tsvector_col tsvector NULL',
90 => 'txid_snapshot_col txid_snapshot NULL DEFAULT NULL',
91 => 'uuid_col uuid NULL DEFAULT NULL',
92 => 'xml_col xml NULL DEFAULT NULL',
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ class m200000_000001_change_table_editcolumns extends \yii\db\Migration
{
public function safeUp()
{
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN first_name varchar NULL DEFAULT NULL")->execute();
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n json NOT NULL DEFAULT \'[]\'")->execute();
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n_2 json NOT NULL DEFAULT \'[]\'")->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN first_name varchar NULL DEFAULT NULL')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n json NOT NULL DEFAULT \'[]\'')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n_2 json NOT NULL DEFAULT \'[]\'')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN text_col_array text[] NULL DEFAULT NULL')->execute();
$this->alterColumn('{{%editcolumns}}', 'dec_col', "SET DEFAULT 3.14");
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ALTER COLUMN json_col SET DATA TYPE text")->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN json_col SET DATA TYPE text')->execute();
$this->alterColumn('{{%editcolumns}}', 'json_col', "SET NOT NULL");
$this->alterColumn('{{%editcolumns}}', 'json_col', "SET DEFAULT 'fox jumps over dog'");
$this->alterColumn('{{%editcolumns}}', 'json_col_2', "SET NOT NULL");
$this->alterColumn('{{%editcolumns}}', 'json_col_2', "SET DEFAULT '[]'");
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ALTER COLUMN name SET DATA TYPE varchar(254)")->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN name SET DATA TYPE varchar(254)')->execute();
$this->alterColumn('{{%editcolumns}}', 'name', "SET DEFAULT 'Horse-2'");
$this->db->createCommand("ALTER TABLE {{%editcolumns}} ALTER COLUMN numeric_col SET DATA TYPE double precision")->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN numeric_col SET DATA TYPE double precision')->execute();
$this->alterColumn('{{%editcolumns}}', 'str_col_def', "SET NOT NULL");
$this->alterColumn('{{%editcolumns}}', 'str_col_def', "DROP DEFAULT");
$this->alterColumn('{{%editcolumns}}', 'string_col', $this->text()->null());
Expand All @@ -31,6 +32,7 @@ public function safeDown()
$this->alterColumn('{{%editcolumns}}', 'numeric_col', 'int4 NULL USING "numeric_col"::int4');
$this->alterColumn('{{%editcolumns}}', 'name', $this->string(255)->notNull());
$this->alterColumn('{{%editcolumns}}', 'json_col', 'jsonb NULL USING "json_col"::jsonb');
$this->dropColumn('{{%editcolumns}}', 'text_col_array');
$this->dropColumn('{{%editcolumns}}', 'json_col_def_n_2');
$this->dropColumn('{{%editcolumns}}', 'json_col_def_n');
$this->dropColumn('{{%editcolumns}}', 'first_name');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function safeUp()
5 => 'numeric_col double precision NULL DEFAULT NULL',
6 => 'json_col_def_n json NOT NULL DEFAULT \'[]\'',
7 => 'json_col_def_n_2 json NOT NULL DEFAULT \'[]\'',
8 => 'text_col_array text[] NULL DEFAULT NULL',
]);
}

Expand Down
Loading