diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.1.sql index 6effd3ba3..0ac710ba4 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.1.sql @@ -24,6 +24,11 @@ create table drop_ref_one ( parent_id UInt32 ) ENGINE = Log(); +create table drop_ref_one_to_one ( + id UInt32, + parent_id UInt32 +) ENGINE = Log(); + create table migtest_e_test_binary ( id UInt32, test_byte16 String, diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.4__dropsFor_1.3.sql index d66b81f56..54c4cfbfb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.4__dropsFor_1.3.sql @@ -21,6 +21,7 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists drop_ref_one_to_one; drop table if exists migtest_e_test_binary; drop table if exists migtest_e_test_json; drop table if exists migtest_e_test_lob; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/idx_clickhouse.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/idx_clickhouse.migrations index f6de06da5..a065cdf68 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/idx_clickhouse.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/idx_clickhouse.migrations @@ -1,6 +1,6 @@ 193400547, 1.0__initial.sql -1036221356, 1.1.sql +-1021430823, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 1015552567, 1.3.sql --252580551, 1.4__dropsFor_1.3.sql +1436420661, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.1.sql index a450821e0..b0c756a54 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.1.sql @@ -33,6 +33,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 bytea, @@ -217,6 +224,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.4__dropsFor_1.3.sql index 099bdbad8..b2cc3a496 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.4__dropsFor_1.3.sql @@ -24,6 +24,8 @@ drop table if exists drop_ref_many cascade; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one cascade; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one cascade; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary cascade; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/idx_cockroach.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/idx_cockroach.migrations index 8688ba882..1a7b300b6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/idx_cockroach.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/idx_cockroach.migrations @@ -1,7 +1,7 @@ 1434934404, 1.0__initial.sql --1445091875, 1.1.sql +-645855838, 1.1.sql 856096334, 1.2__dropsFor_1.1.sql -279468991, 1.3.sql --1398154763, 1.4__dropsFor_1.3.sql +-1416035730, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql index cff474433..354006bde 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql @@ -107,6 +107,12 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 varbinary(16), @@ -306,6 +312,7 @@ alter table table_history add column "select" varchar(255); alter table table_history add column textfield2 varchar(255); call sysproc.admin_cmd('reorg table table_history'); -- apply post alter +create unique index uq_drop_ref_one_to_one_parent_id on drop_ref_one_to_one(parent_id) exclude null keys; alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')); create unique index uq_migtest_e_basic_description on migtest_e_basic(description) exclude null keys; update migtest_e_basic set new_boolean_field = old_boolean; @@ -337,6 +344,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.4__dropsFor_1.3.sql index 38f8b7c59..d103a5885 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.4__dropsFor_1.3.sql @@ -73,6 +73,14 @@ if exists (select seqschema from syscat.sequences where seqschema = current_sche execute stmt; end if; end$$; +drop table drop_ref_one_to_one; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_REF_ONE_TO_ONE_SEQ') then + prepare stmt from 'drop sequence drop_ref_one_to_one_seq'; + execute stmt; +end if; +end$$; drop table migtest_e_test_binary; delimiter $$ begin diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations index e080749fa..32546b4dc 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations @@ -1,7 +1,7 @@ -1467839063, 1.0__initial.sql -1392865974, 1.1.sql +638526085, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql -1811865535, 1.3.sql -1864105401, 1.4__dropsFor_1.3.sql +2087595324, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql index 08008a18a..6885cdf6a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql @@ -33,6 +33,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer auto_increment not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -220,6 +227,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.4__dropsFor_1.3.sql index d66b81f56..54c4cfbfb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.4__dropsFor_1.3.sql @@ -21,6 +21,7 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists drop_ref_one_to_one; drop table if exists migtest_e_test_binary; drop table if exists migtest_e_test_json; drop table if exists migtest_e_test_lob; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_generic.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_generic.migrations index 4adfd909a..14d94ff8a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_generic.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_generic.migrations @@ -1,6 +1,6 @@ -1547037623, 1.0__initial.sql -275373095, 1.1.sql +563570833, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 674925120, 1.3.sql --252580551, 1.4__dropsFor_1.3.sql +1436420661, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql index be023a9de..de6745d0b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql @@ -107,6 +107,12 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 varbinary(16), @@ -306,6 +312,7 @@ alter table table_history add column "select" varchar(255); alter table table_history add column textfield2 varchar(255); call sysproc.admin_cmd('reorg table table_history'); -- apply post alter +create unique index uq_drop_ref_one_to_one_parent_id on drop_ref_one_to_one(parent_id) exclude null keys; alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')); create unique index uq_migtest_e_basic_description on migtest_e_basic(description) exclude null keys; update migtest_e_basic set new_boolean_field = old_boolean; @@ -337,6 +344,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.4__dropsFor_1.3.sql index 38f8b7c59..d103a5885 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.4__dropsFor_1.3.sql @@ -73,6 +73,14 @@ if exists (select seqschema from syscat.sequences where seqschema = current_sche execute stmt; end if; end$$; +drop table drop_ref_one_to_one; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_REF_ONE_TO_ONE_SEQ') then + prepare stmt from 'drop sequence drop_ref_one_to_one_seq'; + execute stmt; +end if; +end$$; drop table migtest_e_test_binary; delimiter $$ begin diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations index c2926700d..e3d6882e5 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations @@ -1,8 +1,8 @@ 1307787475, I__create_tablespaces.sql 2058232717, 1.0__initial.sql -372361421, 1.1.sql +-1168453954, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql 469192394, 1.3.sql -1864105401, 1.4__dropsFor_1.3.sql +2087595324, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql index be023a9de..de6745d0b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql @@ -107,6 +107,12 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 varbinary(16), @@ -306,6 +312,7 @@ alter table table_history add column "select" varchar(255); alter table table_history add column textfield2 varchar(255); call sysproc.admin_cmd('reorg table table_history'); -- apply post alter +create unique index uq_drop_ref_one_to_one_parent_id on drop_ref_one_to_one(parent_id) exclude null keys; alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')); create unique index uq_migtest_e_basic_description on migtest_e_basic(description) exclude null keys; update migtest_e_basic set new_boolean_field = old_boolean; @@ -337,6 +344,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.4__dropsFor_1.3.sql index 38f8b7c59..d103a5885 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.4__dropsFor_1.3.sql @@ -73,6 +73,14 @@ if exists (select seqschema from syscat.sequences where seqschema = current_sche execute stmt; end if; end$$; +drop table drop_ref_one_to_one; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_REF_ONE_TO_ONE_SEQ') then + prepare stmt from 'drop sequence drop_ref_one_to_one_seq'; + execute stmt; +end if; +end$$; drop table migtest_e_test_binary; delimiter $$ begin diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations index 930929aa3..ac0ae9443 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations @@ -1,7 +1,7 @@ 2058232717, 1.0__initial.sql -372361421, 1.1.sql +-1168453954, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql 469192394, 1.3.sql -1864105401, 1.4__dropsFor_1.3.sql +2087595324, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.1.sql index 08008a18a..6885cdf6a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.1.sql @@ -33,6 +33,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer auto_increment not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -220,6 +227,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.4__dropsFor_1.3.sql index d66b81f56..54c4cfbfb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.4__dropsFor_1.3.sql @@ -21,6 +21,7 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists drop_ref_one_to_one; drop table if exists migtest_e_test_binary; drop table if exists migtest_e_test_json; drop table if exists migtest_e_test_lob; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/idx_generic.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/idx_generic.migrations index 4adfd909a..14d94ff8a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/idx_generic.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/idx_generic.migrations @@ -1,6 +1,6 @@ -1547037623, 1.0__initial.sql -275373095, 1.1.sql +563570833, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 674925120, 1.3.sql --252580551, 1.4__dropsFor_1.3.sql +1436420661, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.1.sql index 5b15b853f..a5e3ff8dc 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.1.sql @@ -33,6 +33,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 varbinary(16), @@ -264,6 +271,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.4__dropsFor_1.3.sql index 7dd46268a..840a5dd95 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.4__dropsFor_1.3.sql @@ -50,6 +50,8 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/idx_h2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/idx_h2.migrations index 1a613da0d..46aefebb6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/idx_h2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/idx_h2.migrations @@ -1,8 +1,8 @@ -1854589550, 1.0__initial.sql --505431855, 1.1.sql +768680300, 1.1.sql 1579867974, 1.2__dropsFor_1.1.sql 64466326, 1.3.sql --232694612, 1.4__dropsFor_1.3.sql +334448611, 1.4__dropsFor_1.3.sql 783227075, R__multi_comments.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.1.sql index 84800ffc7..af98ef4af 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.1.sql @@ -81,6 +81,13 @@ create column table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create column table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create column table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 varbinary(16), @@ -295,6 +302,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr -- explicit index "ix_drop_ref_one_parent_id" for single column "parent_id" of table "drop_ref_one" is not necessary; alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + -- explicit index "ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c" for single column "migtest_mtm_c_id" of table "migtest_mtm_c_migtest_mtm_m" is not necessary; alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.4__dropsFor_1.3.sql index ba054e40e..1d0778757 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.4__dropsFor_1.3.sql @@ -39,6 +39,7 @@ drop table drop_main cascade; drop table drop_main_drop_ref_many cascade; drop table drop_ref_many cascade; drop table drop_ref_one cascade; +drop table drop_ref_one_to_one cascade; drop table migtest_e_test_binary cascade; drop table migtest_e_test_json cascade; drop table migtest_e_test_lob cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations index 825081509..47cac48d2 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations @@ -1,8 +1,8 @@ -745347271, I__create_procs.sql -2017770851, 1.0__initial.sql -2126049978, 1.1.sql +-475843596, 1.1.sql 1535221752, 1.2__dropsFor_1.1.sql 1459381570, 1.3.sql --490709749, 1.4__dropsFor_1.3.sql +1613562845, 1.4__dropsFor_1.3.sql 1906063401, R__order_views_hana.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.1.sql index db5e03b99..cde67e99a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.1.sql @@ -33,6 +33,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity (start with 1) not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity (start with 1) not null, test_byte16 varbinary(16), @@ -220,6 +227,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.4__dropsFor_1.3.sql index 42ed7a01d..564997379 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.4__dropsFor_1.3.sql @@ -24,6 +24,8 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations index f8ca1056c..c0d8fb075 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations @@ -1,7 +1,7 @@ 1833930558, 1.0__initial.sql --432003541, 1.1.sql +277065890, 1.1.sql -848622216, 1.2__dropsFor_1.1.sql -1921508585, 1.3.sql --1547659386, 1.4__dropsFor_1.3.sql +-1765256531, 1.4__dropsFor_1.3.sql 861001272, R__order_views_hsqldb.sql 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 13a754cea..0199128d8 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 @@ -30,6 +30,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer auto_increment not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -209,6 +216,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql index 81e4368e2..d550977b0 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql @@ -27,6 +27,8 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json; 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 09c4f565f..e6c87869a 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 @@ -2111548334, 1.0__initial.sql -1717242095, 1.1.sql +1085383251, 1.1.sql 919151678, 1.2__dropsFor_1.1.sql -413458006, 1.3.sql --177212756, 1.4__dropsFor_1.3.sql +-924292968, 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 13a754cea..0199128d8 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 @@ -30,6 +30,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer auto_increment not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -209,6 +216,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql index 2e57704e8..5e501fc5e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql @@ -27,6 +27,8 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json; 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 784e32fd0..365fded3a 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 @@ -1933396282, I__create_procs.sql -2111548334, 1.0__initial.sql -1717242095, 1.1.sql +1085383251, 1.1.sql 1187950993, 1.2__dropsFor_1.1.sql -413458006, 1.3.sql --1494509099, 1.4__dropsFor_1.3.sql +-298825700, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml index d23d982ee..4fded216b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml @@ -29,6 +29,10 @@ + + + + diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml index bd902b317..560192cc9 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml @@ -94,6 +94,7 @@ + diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.4__dropsFor_1.3.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.4__dropsFor_1.3.model.xml index 84b6f2c41..53fefa911 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.4__dropsFor_1.3.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.4__dropsFor_1.3.model.xml @@ -22,6 +22,7 @@ + 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 210723440..8b37ed409 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 @@ -30,6 +30,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer auto_increment not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -327,6 +334,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.4__dropsFor_1.3.sql index 02bf03425..2849d5398 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.4__dropsFor_1.3.sql @@ -81,6 +81,7 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists drop_ref_one_to_one; drop table if exists migtest_e_test_binary; drop table if exists migtest_e_test_json; drop table if exists migtest_e_test_lob; 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 84edad999..88c675441 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 @@ -1933396282, I__create_procs.sql 1980830787, 1.0__initial.sql --847541300, 1.1.sql +-151422898, 1.1.sql -1097227916, 1.2__dropsFor_1.1.sql 141196883, 1.3.sql -1044119359, 1.4__dropsFor_1.3.sql +261977585, 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 210723440..8b37ed409 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 @@ -30,6 +30,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer auto_increment not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -327,6 +334,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.4__dropsFor_1.3.sql index 02bf03425..2849d5398 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.4__dropsFor_1.3.sql @@ -81,6 +81,7 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists drop_ref_one_to_one; drop table if exists migtest_e_test_binary; drop table if exists migtest_e_test_json; drop table if exists migtest_e_test_lob; 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 69f8a0317..6b5f289f7 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 @@ -1933396282, I__create_procs.sql 369577572, 1.0__initial.sql --847541300, 1.1.sql +-151422898, 1.1.sql -1097227916, 1.2__dropsFor_1.1.sql 141196883, 1.3.sql -1044119359, 1.4__dropsFor_1.3.sql +261977585, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.1.sql index b1e603bc7..ab07e1cc9 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.1.sql @@ -33,6 +33,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 varbinary(16), @@ -351,6 +358,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id); + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.4__dropsFor_1.3.sql index 1eda03867..9d8eb8bf6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.4__dropsFor_1.3.sql @@ -90,6 +90,8 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/idx_nuodb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/idx_nuodb.migrations index 85b584cd4..3be3ee1e3 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/idx_nuodb.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/idx_nuodb.migrations @@ -1,7 +1,7 @@ 390216918, 1.0__initial.sql --303196611, 1.1.sql +-1064172809, 1.1.sql 1530685455, 1.2__dropsFor_1.1.sql -956168377, 1.3.sql -1047623430, 1.4__dropsFor_1.3.sql +-381446847, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.1.sql index c222cc8a5..e94b9ac47 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.1.sql @@ -78,6 +78,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id number(10) generated by default as identity not null, + parent_id number(10), + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id number(10) generated by default as identity not null, test_byte16 raw(16), @@ -265,6 +272,8 @@ alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_dr_joesl create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); +alter table drop_ref_one_to_one add constraint fk_drp_rf_n_t_n_prnt_d foreign key (parent_id) references drop_main (id); + create index ix_mgtst_mtm_c_mgtst_mt_3ug4ok on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_mgtst_mtm_c_mgtst_mt_93awga foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.4__dropsFor_1.3.sql index 2a70d5211..c1a01787c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.4__dropsFor_1.3.sql @@ -51,6 +51,17 @@ exception when expected_error then null; end; $$; +drop table drop_ref_one_to_one cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence drop_ref_one_to_one_seq'; +exception + when expected_error then null; +end; +$$; drop table migtest_e_test_binary cascade constraints purge; delimiter $$ declare diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations index 7aff21509..4d4d33fa7 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations @@ -1,8 +1,8 @@ 1757923548, 1.0__initial.sql --1862781653, 1.1.sql +-130678137, 1.1.sql 930172034, 1.2__dropsFor_1.1.sql -647790612, 1.3.sql --116456403, 1.4__dropsFor_1.3.sql +1480920634, 1.4__dropsFor_1.3.sql 1357801733, R__oracle_only_views.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.1.sql index 59d29e649..c30c11571 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.1.sql @@ -81,6 +81,14 @@ create table drop_ref_one ( ); create sequence drop_ref_one_seq; +create table drop_ref_one_to_one ( + id number(10) not null, + parent_id number(10), + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); +create sequence drop_ref_one_to_one_seq; + create table migtest_e_test_binary ( id number(10) not null, test_byte16 raw(16), @@ -273,6 +281,8 @@ alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_dr_joesl create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); +alter table drop_ref_one_to_one add constraint fk_drp_rf_n_t_n_prnt_d foreign key (parent_id) references drop_main (id); + create index ix_mgtst_mtm_c_mgtst_mt_3ug4ok on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_mgtst_mtm_c_mgtst_mt_93awga foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.4__dropsFor_1.3.sql index 2a70d5211..c1a01787c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.4__dropsFor_1.3.sql @@ -51,6 +51,17 @@ exception when expected_error then null; end; $$; +drop table drop_ref_one_to_one cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence drop_ref_one_to_one_seq'; +exception + when expected_error then null; +end; +$$; drop table migtest_e_test_binary cascade constraints purge; delimiter $$ declare diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/idx_oracle.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/idx_oracle.migrations index e1d314b8c..b34cc6bdd 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/idx_oracle.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/idx_oracle.migrations @@ -1,8 +1,8 @@ -1422254768, 1.0__initial.sql -661141209, 1.1.sql +1418539051, 1.1.sql 930172034, 1.2__dropsFor_1.1.sql 1369863782, 1.3.sql --116456403, 1.4__dropsFor_1.3.sql +1480920634, 1.4__dropsFor_1.3.sql 1357801733, R__oracle_only_views.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql index e116daece..331821319 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql @@ -36,6 +36,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 bytea, @@ -422,6 +429,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql index 28f59c8e6..784d289fb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql @@ -120,6 +120,8 @@ drop table if exists drop_ref_many cascade; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one cascade; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one cascade; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary cascade; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations index b919977c3..b615a9879 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations @@ -1,8 +1,8 @@ 1942370812, 1.0__initial.sql --150823045, 1.1.sql +-1945546744, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql 788727457, 1.3.sql --1352224731, 1.4__dropsFor_1.3.sql +1188958800, 1.4__dropsFor_1.3.sql 783227075, R__multi_comments.sql 561281075, R__order_views.sql 283077354, R__pg_indexes.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql index dd0d1827c..4b29b2691 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql @@ -36,6 +36,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id serial not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id serial not null, test_byte16 bytea, @@ -422,6 +429,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql index 28f59c8e6..784d289fb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql @@ -120,6 +120,8 @@ drop table if exists drop_ref_many cascade; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one cascade; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one cascade; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary cascade; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations index e2da8048e..d351b282a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations @@ -1,8 +1,8 @@ -1015076364, 1.0__initial.sql -328269371, 1.1.sql +-1624208025, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql -1811829200, 1.3.sql --1352224731, 1.4__dropsFor_1.3.sql +1188958800, 1.4__dropsFor_1.3.sql 783227075, R__multi_comments.sql 561281075, R__order_views.sql 283077354, R__pg_indexes.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.1.sql index 3383de4ad..d5db941ff 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.1.sql @@ -33,6 +33,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer auto_increment not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -220,6 +227,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.4__dropsFor_1.3.sql index d66b81f56..54c4cfbfb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.4__dropsFor_1.3.sql @@ -21,6 +21,7 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists drop_ref_one_to_one; drop table if exists migtest_e_test_binary; drop table if exists migtest_e_test_json; drop table if exists migtest_e_test_lob; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/idx_sqlanywhere.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/idx_sqlanywhere.migrations index e5f698839..e8b8aa9ca 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/idx_sqlanywhere.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/idx_sqlanywhere.migrations @@ -1,6 +1,6 @@ -391639901, 1.0__initial.sql -974884972, 1.1.sql +1808590378, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 1199670482, 1.3.sql --252580551, 1.4__dropsFor_1.3.sql +1436420661, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.1.sql index 0560f36e7..3229b641f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.1.sql @@ -36,6 +36,14 @@ create table drop_ref_one ( foreign key (parent_id) references drop_main (id) on delete restrict on update restrict ); +create table drop_ref_one_to_one ( + id integer not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id), + foreign key (parent_id) references drop_main (id) on delete restrict on update restrict +); + create table migtest_e_test_binary ( id integer not null, test_byte16 varbinary(16), diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.4__dropsFor_1.3.sql index d66b81f56..54c4cfbfb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.4__dropsFor_1.3.sql @@ -21,6 +21,7 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists drop_ref_one_to_one; drop table if exists migtest_e_test_binary; drop table if exists migtest_e_test_json; drop table if exists migtest_e_test_lob; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations index fe71e16d3..3e3e462d2 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations @@ -1,7 +1,7 @@ -1527127682, 1.0__initial.sql --321125092, 1.1.sql +728006469, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 142780650, 1.3.sql --252580551, 1.4__dropsFor_1.3.sql +1436420661, 1.4__dropsFor_1.3.sql 2034589659, R__order_views_sqlite.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 11db228e6..2bba9c7b9 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 @@ -35,6 +35,12 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer identity(1,1) not null, + parent_id integer, + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer identity(1,1) not null, test_byte16 image, @@ -219,6 +225,7 @@ alter table migtest_e_history6 alter column test_number2 integer; alter table migtest_e_softdelete add deleted bit default 0 not null; alter table migtest_oto_child add master_id bigint; -- apply post alter +create unique nonclustered index uq_drop_ref_one_to_one_parent_id on drop_ref_one_to_one(parent_id) where parent_id is not null; alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')); create unique nonclustered index uq_migtest_e_basic_description on migtest_e_basic(description) where description is not null; update migtest_e_basic set new_boolean_field = old_boolean; @@ -244,6 +251,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id); + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.4__dropsFor_1.3.sql index 1595c2e4f..b2c3ff60a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.4__dropsFor_1.3.sql @@ -43,6 +43,8 @@ IF OBJECT_ID('drop_ref_many', 'U') IS NOT NULL drop table drop_ref_many; IF OBJECT_ID('drop_ref_many_seq', 'SO') IS NOT NULL drop sequence drop_ref_many_seq; IF OBJECT_ID('drop_ref_one', 'U') IS NOT NULL drop table drop_ref_one; IF OBJECT_ID('drop_ref_one_seq', 'SO') IS NOT NULL drop sequence drop_ref_one_seq; +IF OBJECT_ID('drop_ref_one_to_one', 'U') IS NOT NULL drop table drop_ref_one_to_one; +IF OBJECT_ID('drop_ref_one_to_one_seq', 'SO') IS NOT NULL drop sequence drop_ref_one_to_one_seq; IF OBJECT_ID('migtest_e_test_binary', 'U') IS NOT NULL drop table migtest_e_test_binary; IF OBJECT_ID('migtest_e_test_binary_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_binary_seq; IF OBJECT_ID('migtest_e_test_json', 'U') IS NOT NULL drop table migtest_e_test_json; 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 c011a6900..161248043 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 @@ 891357544, I__create_procs.sql -1455820494, 1.0__initial.sql --88313995, 1.1.sql +-2020672101, 1.1.sql -1431095657, 1.2__dropsFor_1.1.sql 1846195516, 1.3.sql --225579996, 1.4__dropsFor_1.3.sql +-1281693740, 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 b79765243..02edd6dbb 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 @@ -38,6 +38,13 @@ create table drop_ref_one ( ); create sequence drop_ref_one_seq as bigint start with 1; +create table drop_ref_one_to_one ( + id integer not null, + parent_id integer, + constraint pk_drop_ref_one_to_one primary key (id) +); +create sequence drop_ref_one_to_one_seq as bigint start with 1; + create table migtest_e_test_binary ( id integer not null, test_byte16 varbinary(16), @@ -227,6 +234,7 @@ alter table migtest_e_history6 alter column test_number2 integer; alter table migtest_e_softdelete add deleted bit default 0 not null; alter table migtest_oto_child add master_id bigint; -- apply post alter +create unique nonclustered index uq_drop_ref_one_to_one_parent_id on drop_ref_one_to_one(parent_id) where parent_id is not null; alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')); create unique nonclustered index uq_migtest_e_basic_description on migtest_e_basic(description) where description is not null; update migtest_e_basic set new_boolean_field = old_boolean; @@ -252,6 +260,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id); + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.4__dropsFor_1.3.sql index 1595c2e4f..b2c3ff60a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.4__dropsFor_1.3.sql @@ -43,6 +43,8 @@ IF OBJECT_ID('drop_ref_many', 'U') IS NOT NULL drop table drop_ref_many; IF OBJECT_ID('drop_ref_many_seq', 'SO') IS NOT NULL drop sequence drop_ref_many_seq; IF OBJECT_ID('drop_ref_one', 'U') IS NOT NULL drop table drop_ref_one; IF OBJECT_ID('drop_ref_one_seq', 'SO') IS NOT NULL drop sequence drop_ref_one_seq; +IF OBJECT_ID('drop_ref_one_to_one', 'U') IS NOT NULL drop table drop_ref_one_to_one; +IF OBJECT_ID('drop_ref_one_to_one_seq', 'SO') IS NOT NULL drop sequence drop_ref_one_to_one_seq; IF OBJECT_ID('migtest_e_test_binary', 'U') IS NOT NULL drop table migtest_e_test_binary; IF OBJECT_ID('migtest_e_test_binary_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_binary_seq; IF OBJECT_ID('migtest_e_test_json', 'U') IS NOT NULL drop table migtest_e_test_json; 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 e843dc30d..004589b70 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 @@ 891357544, I__create_procs.sql 1574627056, 1.0__initial.sql -1681608861, 1.1.sql +1141454658, 1.1.sql -1431095657, 1.2__dropsFor_1.1.sql 486442698, 1.3.sql --225579996, 1.4__dropsFor_1.3.sql +-1281693740, 1.4__dropsFor_1.3.sql 1607822082, R__order_views_mssql.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql index 64478fe81..c20522fc4 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql @@ -33,6 +33,13 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table drop_ref_one_to_one ( + id integer generated by default as identity not null, + parent_id integer, + constraint uq_drop_ref_one_to_one_parent_id unique (parent_id), + constraint pk_drop_ref_one_to_one primary key (id) +); + create table migtest_e_test_binary ( id integer generated by default as identity not null, test_byte16 bytea, @@ -421,6 +428,8 @@ alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_dr create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; +alter table drop_ref_one_to_one add constraint fk_drop_ref_one_to_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql index 28f59c8e6..784d289fb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql @@ -120,6 +120,8 @@ drop table if exists drop_ref_many cascade; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one cascade; drop sequence if exists drop_ref_one_seq; +drop table if exists drop_ref_one_to_one cascade; +drop sequence if exists drop_ref_one_to_one_seq; drop table if exists migtest_e_test_binary cascade; drop sequence if exists migtest_e_test_binary_seq; drop table if exists migtest_e_test_json cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations index a5907171d..a81041bae 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations @@ -1,7 +1,7 @@ -1646972843, 1.0__initial.sql -1912842724, 1.1.sql +-698093883, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql -526466104, 1.3.sql --1352224731, 1.4__dropsFor_1.3.sql +1188958800, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql