diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql index 04603643f..ec9514319 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql @@ -36,9 +36,7 @@ alter table migtest_fk_set_null drop foreign key fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; update migtest_e_basic set status = 'A' where status is null; -alter table migtest_e_basic alter status set default 'A'; -alter table migtest_e_basic modify status varchar(1) not null; -alter table migtest_e_basic alter status2 drop default; +alter table migtest_e_basic modify status varchar(1) not null default 'A'; alter table migtest_e_basic modify status2 varchar(127); -- rename all collisions; @@ -67,8 +65,7 @@ alter table migtest_e_history comment = 'We have history now'; -- NOTE: table has @History - special migration may be necessary SET @@system_versioning_alter_history = 1; update migtest_e_history2 set test_string = 'unknown' where test_string is null; -alter table migtest_e_history2 alter test_string set default 'unknown'; -alter table migtest_e_history2 modify test_string varchar(255) not null; +alter table migtest_e_history2 modify test_string varchar(255) not null default 'unknown'; alter table migtest_e_history2 add column test_string2 varchar(255); alter table migtest_e_history2 add column test_string3 varchar(255) default 'unknown' not null; alter table migtest_e_history2 add column new_column varchar(20); @@ -79,8 +76,7 @@ alter table migtest_e_history5 add column test_boolean tinyint(1) default 0 not -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; -alter table migtest_e_history6 alter test_number1 set default 42; -alter table migtest_e_history6 modify test_number1 integer not null; +alter table migtest_e_history6 modify test_number1 integer not null default 42; alter table migtest_e_history6 modify test_number2 integer; alter table migtest_e_softdelete add column deleted tinyint(1) default 0 not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.3.sql index c3f1dd68f..0425230ac 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.3.sql @@ -14,18 +14,15 @@ alter table migtest_fk_none drop foreign key fk_migtest_fk_none_one_id; alter table migtest_fk_none_via_join drop foreign key fk_migtest_fk_none_via_join_one_id; alter table migtest_fk_set_null drop foreign key fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -alter table migtest_e_basic alter status drop default; alter table migtest_e_basic modify status varchar(1); update migtest_e_basic set status2 = 'N' where status2 is null; -alter table migtest_e_basic alter status2 set default 'N'; -alter table migtest_e_basic modify status2 varchar(1) not null; +alter table migtest_e_basic modify status2 varchar(1) not null default 'N'; alter table migtest_e_basic drop index uq_migtest_e_basic_description; update migtest_e_basic set user_id = 23 where user_id is null; alter table migtest_e_basic drop foreign key fk_migtest_e_basic_user_id; -alter table migtest_e_basic alter user_id set default 23; -alter table migtest_e_basic modify user_id integer not null; +alter table migtest_e_basic modify user_id integer not null default 23; alter table migtest_e_basic add column description_file longblob; alter table migtest_e_basic add column old_boolean tinyint(1) default 0 not null; alter table migtest_e_basic add column old_boolean2 tinyint(1); @@ -38,19 +35,16 @@ alter table migtest_e_basic drop index uq_migtest_e_basic_indextest5; alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest2 unique (indextest2); alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest6 unique (indextest6); alter table migtest_e_history comment = ''; -alter table migtest_e_history2 alter test_string drop default; alter table migtest_e_history2 modify test_string varchar(255); alter table migtest_e_history2 add column obsolete_string1 varchar(255); alter table migtest_e_history2 add column obsolete_string2 varchar(255); alter table migtest_e_history4 modify test_number integer; -alter table migtest_e_history6 alter test_number1 drop default; alter table migtest_e_history6 modify test_number1 integer; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; -alter table migtest_e_history6 alter test_number2 set default 7; -alter table migtest_e_history6 modify test_number2 integer not null; +alter table migtest_e_history6 modify test_number2 integer not null default 7; create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1); create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5); drop index ix_migtest_e_basic_indextest3 on migtest_e_basic; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations index a66b70c10..d1d18beb6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations @@ -1,7 +1,7 @@ -616900688, 1.0__initial.sql -128637084, 1.1.sql +-786596816, 1.1.sql -2077736415, 1.2__dropsFor_1.1.sql --1744111309, 1.3.sql +1262945599, 1.3.sql 89701608, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql index 04603643f..ec9514319 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql @@ -36,9 +36,7 @@ alter table migtest_fk_set_null drop foreign key fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; update migtest_e_basic set status = 'A' where status is null; -alter table migtest_e_basic alter status set default 'A'; -alter table migtest_e_basic modify status varchar(1) not null; -alter table migtest_e_basic alter status2 drop default; +alter table migtest_e_basic modify status varchar(1) not null default 'A'; alter table migtest_e_basic modify status2 varchar(127); -- rename all collisions; @@ -67,8 +65,7 @@ alter table migtest_e_history comment = 'We have history now'; -- NOTE: table has @History - special migration may be necessary SET @@system_versioning_alter_history = 1; update migtest_e_history2 set test_string = 'unknown' where test_string is null; -alter table migtest_e_history2 alter test_string set default 'unknown'; -alter table migtest_e_history2 modify test_string varchar(255) not null; +alter table migtest_e_history2 modify test_string varchar(255) not null default 'unknown'; alter table migtest_e_history2 add column test_string2 varchar(255); alter table migtest_e_history2 add column test_string3 varchar(255) default 'unknown' not null; alter table migtest_e_history2 add column new_column varchar(20); @@ -79,8 +76,7 @@ alter table migtest_e_history5 add column test_boolean tinyint(1) default 0 not -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; -alter table migtest_e_history6 alter test_number1 set default 42; -alter table migtest_e_history6 modify test_number1 integer not null; +alter table migtest_e_history6 modify test_number1 integer not null default 42; alter table migtest_e_history6 modify test_number2 integer; alter table migtest_e_softdelete add column deleted tinyint(1) default 0 not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.3.sql index c3f1dd68f..0425230ac 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.3.sql @@ -14,18 +14,15 @@ alter table migtest_fk_none drop foreign key fk_migtest_fk_none_one_id; alter table migtest_fk_none_via_join drop foreign key fk_migtest_fk_none_via_join_one_id; alter table migtest_fk_set_null drop foreign key fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -alter table migtest_e_basic alter status drop default; alter table migtest_e_basic modify status varchar(1); update migtest_e_basic set status2 = 'N' where status2 is null; -alter table migtest_e_basic alter status2 set default 'N'; -alter table migtest_e_basic modify status2 varchar(1) not null; +alter table migtest_e_basic modify status2 varchar(1) not null default 'N'; alter table migtest_e_basic drop index uq_migtest_e_basic_description; update migtest_e_basic set user_id = 23 where user_id is null; alter table migtest_e_basic drop foreign key fk_migtest_e_basic_user_id; -alter table migtest_e_basic alter user_id set default 23; -alter table migtest_e_basic modify user_id integer not null; +alter table migtest_e_basic modify user_id integer not null default 23; alter table migtest_e_basic add column description_file longblob; alter table migtest_e_basic add column old_boolean tinyint(1) default 0 not null; alter table migtest_e_basic add column old_boolean2 tinyint(1); @@ -38,19 +35,16 @@ alter table migtest_e_basic drop index uq_migtest_e_basic_indextest5; alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest2 unique (indextest2); alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest6 unique (indextest6); alter table migtest_e_history comment = ''; -alter table migtest_e_history2 alter test_string drop default; alter table migtest_e_history2 modify test_string varchar(255); alter table migtest_e_history2 add column obsolete_string1 varchar(255); alter table migtest_e_history2 add column obsolete_string2 varchar(255); alter table migtest_e_history4 modify test_number integer; -alter table migtest_e_history6 alter test_number1 drop default; alter table migtest_e_history6 modify test_number1 integer; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; -alter table migtest_e_history6 alter test_number2 set default 7; -alter table migtest_e_history6 modify test_number2 integer not null; +alter table migtest_e_history6 modify test_number2 integer not null default 7; create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1); create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5); drop index ix_migtest_e_basic_indextest3 on migtest_e_basic; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations index d7958ff29..00322e59e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations @@ -1,8 +1,8 @@ 1835064798, I__create_procs.sql -616900688, 1.0__initial.sql -128637084, 1.1.sql +-786596816, 1.1.sql -2098746494, 1.2__dropsFor_1.1.sql --1744111309, 1.3.sql +1262945599, 1.3.sql 930722740, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.1.sql index 16d54565f..020fbaa27 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.1.sql @@ -42,9 +42,7 @@ alter table migtest_fk_set_null drop foreign key fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; update migtest_e_basic set status = 'A' where status is null; -alter table migtest_e_basic alter status set default 'A'; -alter table migtest_e_basic modify status varchar(1) not null; -alter table migtest_e_basic alter status2 drop default; +alter table migtest_e_basic modify status varchar(1) not null default 'A'; alter table migtest_e_basic modify status2 varchar(127); -- rename all collisions; @@ -72,8 +70,7 @@ alter table migtest_e_history comment = 'We have history now'; -- NOTE: table has @History - special migration may be necessary update migtest_e_history2 set test_string = 'unknown' where test_string is null; -alter table migtest_e_history2 alter test_string set default 'unknown'; -alter table migtest_e_history2 modify test_string varchar(255) not null; +alter table migtest_e_history2 modify test_string varchar(255) not null default 'unknown'; alter table migtest_e_history2 add column test_string2 varchar(255); alter table migtest_e_history2 add column test_string3 varchar(255) default 'unknown' not null; alter table migtest_e_history2 add column new_column varchar(20); @@ -89,8 +86,7 @@ alter table migtest_e_history5_history add column test_boolean tinyint(1) defaul -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; -alter table migtest_e_history6 alter test_number1 set default 42; -alter table migtest_e_history6 modify test_number1 integer not null; +alter table migtest_e_history6 modify test_number1 integer not null default 42; alter table migtest_e_history6 modify test_number2 integer; alter table migtest_e_softdelete add column deleted tinyint(1) default 0 not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.3.sql index b3d9845a5..2eb7ccc79 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.3.sql @@ -19,18 +19,15 @@ alter table migtest_fk_none drop foreign key fk_migtest_fk_none_one_id; alter table migtest_fk_none_via_join drop foreign key fk_migtest_fk_none_via_join_one_id; alter table migtest_fk_set_null drop foreign key fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -alter table migtest_e_basic alter status drop default; alter table migtest_e_basic modify status varchar(1); update migtest_e_basic set status2 = 'N' where status2 is null; -alter table migtest_e_basic alter status2 set default 'N'; -alter table migtest_e_basic modify status2 varchar(1) not null; +alter table migtest_e_basic modify status2 varchar(1) not null default 'N'; alter table migtest_e_basic drop index uq_migtest_e_basic_description; update migtest_e_basic set user_id = 23 where user_id is null; alter table migtest_e_basic drop foreign key fk_migtest_e_basic_user_id; -alter table migtest_e_basic alter user_id set default 23; -alter table migtest_e_basic modify user_id integer not null; +alter table migtest_e_basic modify user_id integer not null default 23; alter table migtest_e_basic add column description_file longblob; alter table migtest_e_basic add column old_boolean tinyint(1) default 0 not null; alter table migtest_e_basic add column old_boolean2 tinyint(1); @@ -43,7 +40,6 @@ alter table migtest_e_basic drop index uq_migtest_e_basic_indextest5; alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest2 unique (indextest2); alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest6 unique (indextest6); alter table migtest_e_history comment = ''; -alter table migtest_e_history2 alter test_string drop default; alter table migtest_e_history2 modify test_string varchar(255); alter table migtest_e_history2 add column obsolete_string1 varchar(255); alter table migtest_e_history2 add column obsolete_string2 varchar(255); @@ -52,13 +48,11 @@ alter table migtest_e_history2_history add column obsolete_string2 varchar(255); alter table migtest_e_history4 modify test_number integer; alter table migtest_e_history4_history modify test_number integer; -alter table migtest_e_history6 alter test_number1 drop default; alter table migtest_e_history6 modify test_number1 integer; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; -alter table migtest_e_history6 alter test_number2 set default 7; -alter table migtest_e_history6 modify test_number2 integer not null; +alter table migtest_e_history6 modify test_number2 integer not null default 7; alter table migtest_oto_child add constraint uq_m12_otoc72 unique (name); alter table migtest_oto_master add constraint uq_migtest_oto_master_name unique (name); create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations index 5dbbf2fd2..2ff170b68 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations @@ -1,8 +1,8 @@ 1835064798, I__create_procs.sql 890673066, 1.0__initial.sql --1627573867, 1.1.sql +67386209, 1.1.sql 1986189381, 1.2__dropsFor_1.1.sql -798979911, 1.3.sql +2054074037, 1.3.sql -1373040825, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.1.sql index 16d54565f..020fbaa27 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.1.sql @@ -42,9 +42,7 @@ alter table migtest_fk_set_null drop foreign key fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; update migtest_e_basic set status = 'A' where status is null; -alter table migtest_e_basic alter status set default 'A'; -alter table migtest_e_basic modify status varchar(1) not null; -alter table migtest_e_basic alter status2 drop default; +alter table migtest_e_basic modify status varchar(1) not null default 'A'; alter table migtest_e_basic modify status2 varchar(127); -- rename all collisions; @@ -72,8 +70,7 @@ alter table migtest_e_history comment = 'We have history now'; -- NOTE: table has @History - special migration may be necessary update migtest_e_history2 set test_string = 'unknown' where test_string is null; -alter table migtest_e_history2 alter test_string set default 'unknown'; -alter table migtest_e_history2 modify test_string varchar(255) not null; +alter table migtest_e_history2 modify test_string varchar(255) not null default 'unknown'; alter table migtest_e_history2 add column test_string2 varchar(255); alter table migtest_e_history2 add column test_string3 varchar(255) default 'unknown' not null; alter table migtest_e_history2 add column new_column varchar(20); @@ -89,8 +86,7 @@ alter table migtest_e_history5_history add column test_boolean tinyint(1) defaul -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; -alter table migtest_e_history6 alter test_number1 set default 42; -alter table migtest_e_history6 modify test_number1 integer not null; +alter table migtest_e_history6 modify test_number1 integer not null default 42; alter table migtest_e_history6 modify test_number2 integer; alter table migtest_e_softdelete add column deleted tinyint(1) default 0 not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.3.sql index b3d9845a5..2eb7ccc79 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.3.sql @@ -19,18 +19,15 @@ alter table migtest_fk_none drop foreign key fk_migtest_fk_none_one_id; alter table migtest_fk_none_via_join drop foreign key fk_migtest_fk_none_via_join_one_id; alter table migtest_fk_set_null drop foreign key fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -alter table migtest_e_basic alter status drop default; alter table migtest_e_basic modify status varchar(1); update migtest_e_basic set status2 = 'N' where status2 is null; -alter table migtest_e_basic alter status2 set default 'N'; -alter table migtest_e_basic modify status2 varchar(1) not null; +alter table migtest_e_basic modify status2 varchar(1) not null default 'N'; alter table migtest_e_basic drop index uq_migtest_e_basic_description; update migtest_e_basic set user_id = 23 where user_id is null; alter table migtest_e_basic drop foreign key fk_migtest_e_basic_user_id; -alter table migtest_e_basic alter user_id set default 23; -alter table migtest_e_basic modify user_id integer not null; +alter table migtest_e_basic modify user_id integer not null default 23; alter table migtest_e_basic add column description_file longblob; alter table migtest_e_basic add column old_boolean tinyint(1) default 0 not null; alter table migtest_e_basic add column old_boolean2 tinyint(1); @@ -43,7 +40,6 @@ alter table migtest_e_basic drop index uq_migtest_e_basic_indextest5; alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest2 unique (indextest2); alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest6 unique (indextest6); alter table migtest_e_history comment = ''; -alter table migtest_e_history2 alter test_string drop default; alter table migtest_e_history2 modify test_string varchar(255); alter table migtest_e_history2 add column obsolete_string1 varchar(255); alter table migtest_e_history2 add column obsolete_string2 varchar(255); @@ -52,13 +48,11 @@ alter table migtest_e_history2_history add column obsolete_string2 varchar(255); alter table migtest_e_history4 modify test_number integer; alter table migtest_e_history4_history modify test_number integer; -alter table migtest_e_history6 alter test_number1 drop default; alter table migtest_e_history6 modify test_number1 integer; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; -alter table migtest_e_history6 alter test_number2 set default 7; -alter table migtest_e_history6 modify test_number2 integer not null; +alter table migtest_e_history6 modify test_number2 integer not null default 7; alter table migtest_oto_child add constraint uq_m12_otoc72 unique (name); alter table migtest_oto_master add constraint uq_migtest_oto_master_name unique (name); create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations index 5994ca140..cba785aa6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations @@ -1,8 +1,8 @@ 1835064798, I__create_procs.sql 881444156, 1.0__initial.sql --1627573867, 1.1.sql +67386209, 1.1.sql 1986189381, 1.2__dropsFor_1.1.sql -798979911, 1.3.sql +2054074037, 1.3.sql -1373040825, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.1.sql index 51c12789a..bd340a266 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.1.sql @@ -36,11 +36,12 @@ IF OBJECT_ID('fk_migtest_fk_set_null_one_id', 'F') IS NOT NULL alter table migte alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id); update migtest_e_basic set status = 'A' where status is null; -IF (OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status; -alter table migtest_e_basic add default 'A' for status; +IF OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status; +EXEC usp_ebean_drop_default_constraint migtest_e_basic, status; alter table migtest_e_basic alter column status varchar(1) not null; +alter table migtest_e_basic add default 'A' for status; alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')); -IF (OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2; +IF OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2; EXEC usp_ebean_drop_default_constraint migtest_e_basic, status2; alter table migtest_e_basic alter column status2 varchar(127); @@ -60,20 +61,21 @@ alter table migtest_e_basic add constraint ck_migtest_e_basic_progress check ( p alter table migtest_e_basic add new_integer integer default 42 not null; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest2') drop index uq_migtest_e_basic_indextest2 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_indextest2', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2; +IF OBJECT_ID('uq_migtest_e_basic_indextest2', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest6') drop index uq_migtest_e_basic_indextest6 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_indextest6', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6; +IF OBJECT_ID('uq_migtest_e_basic_indextest6', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6; create unique nonclustered index uq_migtest_e_basic_status_indextest1 on migtest_e_basic(status,indextest1) where indextest1 is not null; create unique nonclustered index uq_migtest_e_basic_name on migtest_e_basic(name) where name is not null; create unique nonclustered index uq_migtest_e_basic_indextest4 on migtest_e_basic(indextest4) where indextest4 is not null; create unique nonclustered index uq_migtest_e_basic_indextest5 on migtest_e_basic(indextest5) where indextest5 is not null; -IF (OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL) alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status; +IF OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status; alter table migtest_e_history alter column test_string numeric(19); -- NOTE: table has @History - special migration may be necessary update migtest_e_history2 set test_string = 'unknown' where test_string is null; -alter table migtest_e_history2 add default 'unknown' for test_string; +EXEC usp_ebean_drop_default_constraint migtest_e_history2, test_string; alter table migtest_e_history2 alter column test_string varchar(255) not null; +alter table migtest_e_history2 add default 'unknown' for test_string; alter table migtest_e_history2 add test_string2 varchar(255); alter table migtest_e_history2 add test_string3 varchar(255) default 'unknown' not null; alter table migtest_e_history2 add new_column varchar(20); @@ -84,8 +86,9 @@ alter table migtest_e_history5 add test_boolean bit default 0 not null; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; -alter table migtest_e_history6 add default 42 for test_number1; +EXEC usp_ebean_drop_default_constraint migtest_e_history6, test_number1; alter table migtest_e_history6 alter column test_number1 integer not null; +alter table migtest_e_history6 add default 42 for test_number1; alter table migtest_e_history6 alter column test_number2 integer; alter table migtest_e_softdelete add deleted bit default 0 not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.3.sql index 004107385..7915d515c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.3.sql @@ -14,39 +14,41 @@ IF OBJECT_ID('fk_migtest_fk_none_one_id', 'F') IS NOT NULL alter table migtest_f IF OBJECT_ID('fk_migtest_fk_none_via_join_one_id', 'F') IS NOT NULL alter table migtest_fk_none_via_join drop constraint fk_migtest_fk_none_via_join_one_id; IF OBJECT_ID('fk_migtest_fk_set_null_one_id', 'F') IS NOT NULL alter table migtest_fk_set_null drop constraint fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null; -IF (OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status; +IF OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status; EXEC usp_ebean_drop_default_constraint migtest_e_basic, status; alter table migtest_e_basic alter column status varchar(1); alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I')); update migtest_e_basic set status2 = 'N' where status2 is null; -IF (OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2; -alter table migtest_e_basic add default 'N' for status2; +IF OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2; +EXEC usp_ebean_drop_default_constraint migtest_e_basic, status2; alter table migtest_e_basic alter column status2 varchar(1) not null; +alter table migtest_e_basic add default 'N' for status2; alter table migtest_e_basic add constraint ck_migtest_e_basic_status2 check ( status2 in ('N','A','I')); IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_description') drop index uq_migtest_e_basic_description ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_description', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_description; +IF OBJECT_ID('uq_migtest_e_basic_description', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_description; update migtest_e_basic set user_id = 23 where user_id is null; IF OBJECT_ID('fk_migtest_e_basic_user_id', 'F') IS NOT NULL alter table migtest_e_basic drop constraint fk_migtest_e_basic_user_id; -alter table migtest_e_basic add default 23 for user_id; +EXEC usp_ebean_drop_default_constraint migtest_e_basic, user_id; alter table migtest_e_basic alter column user_id integer not null; +alter table migtest_e_basic add default 23 for user_id; alter table migtest_e_basic add description_file image; alter table migtest_e_basic add old_boolean bit default 0 not null; alter table migtest_e_basic add old_boolean2 bit; alter table migtest_e_basic add eref_id integer; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_status_indextest1') drop index uq_migtest_e_basic_status_indextest1 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_status_indextest1', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_status_indextest1; +IF OBJECT_ID('uq_migtest_e_basic_status_indextest1', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_status_indextest1; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_name') drop index uq_migtest_e_basic_name ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_name', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_name; +IF OBJECT_ID('uq_migtest_e_basic_name', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_name; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest4') drop index uq_migtest_e_basic_indextest4 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_indextest4', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest4; +IF OBJECT_ID('uq_migtest_e_basic_indextest4', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest4; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest5') drop index uq_migtest_e_basic_indextest5 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_indextest5', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest5; +IF OBJECT_ID('uq_migtest_e_basic_indextest5', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest5; create unique nonclustered index uq_migtest_e_basic_indextest2 on migtest_e_basic(indextest2) where indextest2 is not null; create unique nonclustered index uq_migtest_e_basic_indextest6 on migtest_e_basic(indextest6) where indextest6 is not null; -IF (OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL) alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status; +IF OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status; alter table migtest_e_enum add constraint ck_migtest_e_enum_test_status check ( test_status in ('N','A','I')); EXEC usp_ebean_drop_default_constraint migtest_e_history2, test_string; alter table migtest_e_history2 alter column test_string varchar(255); @@ -59,8 +61,9 @@ alter table migtest_e_history6 alter column test_number1 integer; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; -alter table migtest_e_history6 add default 7 for test_number2; +EXEC usp_ebean_drop_default_constraint migtest_e_history6, test_number2; alter table migtest_e_history6 alter column test_number2 integer not null; +alter table migtest_e_history6 add default 7 for test_number2; create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1); create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5); IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'ix_migtest_e_basic_indextest3') drop index ix_migtest_e_basic_indextest3 ON migtest_e_basic; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations index a147ed2f5..619e350d6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations @@ -1,8 +1,8 @@ -2122378240, I__create_procs.sql 1983037247, 1.0__initial.sql --1042228916, 1.1.sql +1735900055, 1.1.sql 1019731053, 1.2__dropsFor_1.1.sql --897790738, 1.3.sql +239521374, 1.3.sql -1335541264, 1.4__dropsFor_1.3.sql 1607822082, R__order_views_mssql.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.1.sql index 9090ca711..4b142aa09 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.1.sql @@ -37,11 +37,12 @@ IF OBJECT_ID('fk_migtest_fk_set_null_one_id', 'F') IS NOT NULL alter table migte alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id); update migtest_e_basic set status = 'A' where status is null; -IF (OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status; -alter table migtest_e_basic add default 'A' for status; +IF OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status; +EXEC usp_ebean_drop_default_constraint migtest_e_basic, status; alter table migtest_e_basic alter column status nvarchar(1) not null; +alter table migtest_e_basic add default 'A' for status; alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')); -IF (OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2; +IF OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2; EXEC usp_ebean_drop_default_constraint migtest_e_basic, status2; alter table migtest_e_basic alter column status2 nvarchar(127); @@ -61,20 +62,21 @@ alter table migtest_e_basic add constraint ck_migtest_e_basic_progress check ( p alter table migtest_e_basic add new_integer integer default 42 not null; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest2') drop index uq_migtest_e_basic_indextest2 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_indextest2', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2; +IF OBJECT_ID('uq_migtest_e_basic_indextest2', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest6') drop index uq_migtest_e_basic_indextest6 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_indextest6', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6; +IF OBJECT_ID('uq_migtest_e_basic_indextest6', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6; create unique nonclustered index uq_migtest_e_basic_status_indextest1 on migtest_e_basic(status,indextest1) where indextest1 is not null; create unique nonclustered index uq_migtest_e_basic_name on migtest_e_basic(name) where name is not null; create unique nonclustered index uq_migtest_e_basic_indextest4 on migtest_e_basic(indextest4) where indextest4 is not null; create unique nonclustered index uq_migtest_e_basic_indextest5 on migtest_e_basic(indextest5) where indextest5 is not null; -IF (OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL) alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status; +IF OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status; alter table migtest_e_history alter column test_string numeric(19); -- NOTE: table has @History - special migration may be necessary update migtest_e_history2 set test_string = 'unknown' where test_string is null; -alter table migtest_e_history2 add default 'unknown' for test_string; +EXEC usp_ebean_drop_default_constraint migtest_e_history2, test_string; alter table migtest_e_history2 alter column test_string nvarchar(255) not null; +alter table migtest_e_history2 add default 'unknown' for test_string; alter table migtest_e_history2 add test_string2 nvarchar(255); alter table migtest_e_history2 add test_string3 nvarchar(255) default 'unknown' not null; alter table migtest_e_history2 add new_column nvarchar(20); @@ -85,8 +87,9 @@ alter table migtest_e_history5 add test_boolean bit default 0 not null; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; -alter table migtest_e_history6 add default 42 for test_number1; +EXEC usp_ebean_drop_default_constraint migtest_e_history6, test_number1; alter table migtest_e_history6 alter column test_number1 integer not null; +alter table migtest_e_history6 add default 42 for test_number1; alter table migtest_e_history6 alter column test_number2 integer; alter table migtest_e_softdelete add deleted bit default 0 not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.3.sql index fde85d001..23dacc249 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.3.sql @@ -15,39 +15,41 @@ IF OBJECT_ID('fk_migtest_fk_none_one_id', 'F') IS NOT NULL alter table migtest_f IF OBJECT_ID('fk_migtest_fk_none_via_join_one_id', 'F') IS NOT NULL alter table migtest_fk_none_via_join drop constraint fk_migtest_fk_none_via_join_one_id; IF OBJECT_ID('fk_migtest_fk_set_null_one_id', 'F') IS NOT NULL alter table migtest_fk_set_null drop constraint fk_migtest_fk_set_null_one_id; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null; -IF (OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status; +IF OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status; EXEC usp_ebean_drop_default_constraint migtest_e_basic, status; alter table migtest_e_basic alter column status nvarchar(1); alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I')); update migtest_e_basic set status2 = 'N' where status2 is null; -IF (OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2; -alter table migtest_e_basic add default 'N' for status2; +IF OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2; +EXEC usp_ebean_drop_default_constraint migtest_e_basic, status2; alter table migtest_e_basic alter column status2 nvarchar(1) not null; +alter table migtest_e_basic add default 'N' for status2; alter table migtest_e_basic add constraint ck_migtest_e_basic_status2 check ( status2 in ('N','A','I')); IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_description') drop index uq_migtest_e_basic_description ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_description', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_description; +IF OBJECT_ID('uq_migtest_e_basic_description', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_description; update migtest_e_basic set user_id = 23 where user_id is null; IF OBJECT_ID('fk_migtest_e_basic_user_id', 'F') IS NOT NULL alter table migtest_e_basic drop constraint fk_migtest_e_basic_user_id; -alter table migtest_e_basic add default 23 for user_id; +EXEC usp_ebean_drop_default_constraint migtest_e_basic, user_id; alter table migtest_e_basic alter column user_id integer not null; +alter table migtest_e_basic add default 23 for user_id; alter table migtest_e_basic add description_file image; alter table migtest_e_basic add old_boolean bit default 0 not null; alter table migtest_e_basic add old_boolean2 bit; alter table migtest_e_basic add eref_id integer; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_status_indextest1') drop index uq_migtest_e_basic_status_indextest1 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_status_indextest1', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_status_indextest1; +IF OBJECT_ID('uq_migtest_e_basic_status_indextest1', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_status_indextest1; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_name') drop index uq_migtest_e_basic_name ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_name', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_name; +IF OBJECT_ID('uq_migtest_e_basic_name', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_name; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest4') drop index uq_migtest_e_basic_indextest4 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_indextest4', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest4; +IF OBJECT_ID('uq_migtest_e_basic_indextest4', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest4; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest5') drop index uq_migtest_e_basic_indextest5 ON migtest_e_basic; -IF (OBJECT_ID('uq_migtest_e_basic_indextest5', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest5; +IF OBJECT_ID('uq_migtest_e_basic_indextest5', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest5; create unique nonclustered index uq_migtest_e_basic_indextest2 on migtest_e_basic(indextest2) where indextest2 is not null; create unique nonclustered index uq_migtest_e_basic_indextest6 on migtest_e_basic(indextest6) where indextest6 is not null; -IF (OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL) alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status; +IF OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status; alter table migtest_e_enum add constraint ck_migtest_e_enum_test_status check ( test_status in ('N','A','I')); EXEC usp_ebean_drop_default_constraint migtest_e_history2, test_string; alter table migtest_e_history2 alter column test_string nvarchar(255); @@ -60,8 +62,9 @@ alter table migtest_e_history6 alter column test_number1 integer; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; -alter table migtest_e_history6 add default 7 for test_number2; +EXEC usp_ebean_drop_default_constraint migtest_e_history6, test_number2; alter table migtest_e_history6 alter column test_number2 integer not null; +alter table migtest_e_history6 add default 7 for test_number2; create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1); create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5); IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'ix_migtest_e_basic_indextest3') drop index ix_migtest_e_basic_indextest3 ON migtest_e_basic; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations index 95435eb0b..69734f2f2 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations @@ -1,8 +1,8 @@ -2122378240, I__create_procs.sql -813787447, 1.0__initial.sql --898063858, 1.1.sql +-925841767, 1.1.sql 1019731053, 1.2__dropsFor_1.1.sql --494373130, 1.3.sql +-1858208, 1.3.sql -1335541264, 1.4__dropsFor_1.3.sql 1607822082, R__order_views_mssql.sql