diff --git a/ebean-api/src/main/java/io/ebean/text/json/JsonBeanReader.java b/ebean-api/src/main/java/io/ebean/text/json/JsonBeanReader.java index 8fde33c47..935b78860 100644 --- a/ebean-api/src/main/java/io/ebean/text/json/JsonBeanReader.java +++ b/ebean-api/src/main/java/io/ebean/text/json/JsonBeanReader.java @@ -23,7 +23,7 @@ public interface JsonBeanReader { default T read() { return read(null); } - + /** * Create a new reader taking the context from the existing one but using a new JsonParser. */ diff --git a/ebean-api/src/main/java/io/ebean/text/json/JsonContext.java b/ebean-api/src/main/java/io/ebean/text/json/JsonContext.java index e05881609..d2c0df822 100644 --- a/ebean-api/src/main/java/io/ebean/text/json/JsonContext.java +++ b/ebean-api/src/main/java/io/ebean/text/json/JsonContext.java @@ -59,73 +59,49 @@ public interface JsonContext { T toBean(Class cls, JsonParser parser, JsonReadOptions options) throws JsonIOException; /** -<<<<<<< HEAD - * Convert json parser input into a Bean of a specific type. -======= * Read json parser input into a given Bean.
* Note: This is a kind of "update". Only properties in the json will be modified. Embedded Lists and Maps will become new * instances, so the object identity will not be preserved here. ->>>>>>> upstream/master * * @throws JsonIOException When IOException occurs */ void toBean(T target, JsonParser parser) throws JsonIOException; /** -<<<<<<< HEAD - * Convert json parser input into a Bean of a specific type additionally using JsonReadOptions.. -======= * Read json parser input into a given Bean additionally using JsonReadOptions.
* See {@link #toBean(Class, JsonParser)} for details modified. ->>>>>>> upstream/master * * @throws JsonIOException When IOException occurs */ void toBean(T target, JsonParser parser, JsonReadOptions options) throws JsonIOException; /** -<<<<<<< HEAD - * Convert json reader input into a Bean of a specific type. -======= * Read json reader input into a given Bean.
* See {@link #toBean(Class, JsonParser)} for details ->>>>>>> upstream/master * * @throws JsonIOException When IOException occurs */ void toBean(T target, Reader json) throws JsonIOException; /** -<<<<<<< HEAD - * Convert json reader input into a Bean of a specific type additionally using JsonReadOptions. -======= * Read json reader input into a given Bean additionally using JsonReadOptions.
* See {@link #toBean(Class, JsonParser)} for details modified. ->>>>>>> upstream/master * * @throws JsonIOException When IOException occurs */ void toBean(T target, Reader json, JsonReadOptions options) throws JsonIOException; /** -<<<<<<< HEAD - * Convert json string input into a Bean of a specific type. -======= * Read json string input into a given Bean.
* See {@link #toBean(Class, JsonParser)} for details ->>>>>>> upstream/master * * @throws JsonIOException When IOException occurs */ void toBean(T target, String json) throws JsonIOException; /** -<<<<<<< HEAD - * Convert json string input into a Bean of a specific type additionally using JsonReadOptions. -======= * Read json string input into a given Bean additionally using JsonReadOptions.
* See {@link #toBean(Class, JsonParser)} for details ->>>>>>> upstream/master * * @throws JsonIOException When IOException occurs */ diff --git a/ebean-bom/pom.xml b/ebean-bom/pom.xml index 5831c8db8..a3ab412dc 100644 --- a/ebean-bom/pom.xml +++ b/ebean-bom/pom.xml @@ -95,7 +95,7 @@ io.ebean ebean-dbmigration-runner - 13.2.1-SNAPSHOT + 13.3.0-SNAPSHOT diff --git a/ebean-dbmigration-runner/src/main/java9/module-info.java b/ebean-dbmigration-runner/src/main/java9/module-info.java deleted file mode 100644 index 8bf31c0d5..000000000 --- a/ebean-dbmigration-runner/src/main/java9/module-info.java +++ /dev/null @@ -1,11 +0,0 @@ -open module io.ebean.dbmigration.runner { - - provides io.ebean.plugin.Plugin with io.ebeaninternal.dbmigration.run.DbRunMigrationPlugin; - - requires transitive io.ebean.ddl.runner; - requires transitive io.ebean.core; - requires transitive java.xml.bind; - requires io.ebean.core.type; - requires io.ebean.migration; - -} diff --git a/ebean-ddl-generator/pom.xml b/ebean-ddl-generator/pom.xml index 860229330..530a54797 100644 --- a/ebean-ddl-generator/pom.xml +++ b/ebean-ddl-generator/pom.xml @@ -58,7 +58,7 @@ io.ebean ebean-dbmigration-runner - 13.2.1-SNAPSHOT + 13.3.0-SNAPSHOT test @@ -83,13 +83,6 @@ test - - com.ibm.db2 - jcc - 11.5.6.0 - test - - diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/model/1.0__initial.model.xml b/ebean-ddl-generator/src/test/resources/mysql/procedures/model/1.0__initial.model.xml similarity index 100% rename from ebean-test/src/test/resources/migrationtest-procedures/dbmigration/model/1.0__initial.model.xml rename to ebean-ddl-generator/src/test/resources/mysql/procedures/model/1.0__initial.model.xml diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/model/1.1.model.xml b/ebean-ddl-generator/src/test/resources/mysql/procedures/model/1.1.model.xml similarity index 100% rename from ebean-test/src/test/resources/migrationtest-procedures/dbmigration/model/1.1.model.xml rename to ebean-ddl-generator/src/test/resources/mysql/procedures/model/1.1.model.xml diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/model/1.2__dropsFor_1.1.model.xml b/ebean-ddl-generator/src/test/resources/mysql/procedures/model/1.2__dropsFor_1.1.model.xml similarity index 100% rename from ebean-test/src/test/resources/migrationtest-procedures/dbmigration/model/1.2__dropsFor_1.1.model.xml rename to ebean-ddl-generator/src/test/resources/mysql/procedures/model/1.2__dropsFor_1.1.model.xml diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/1.0__initial.sql b/ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/1.0__initial.sql similarity index 100% rename from ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/1.0__initial.sql rename to ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/1.0__initial.sql diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/1.2__dropsFor_1.1.sql b/ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/1.2__dropsFor_1.1.sql similarity index 100% rename from ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/1.2__dropsFor_1.1.sql rename to ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/1.2__dropsFor_1.1.sql diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/I__create_procs.sql b/ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/I__create_procs.sql similarity index 100% rename from ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/I__create_procs.sql rename to ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/I__create_procs.sql diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/idx_mysql.migrations b/ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/idx_mysql.migrations similarity index 75% rename from ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/idx_mysql.migrations rename to ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/idx_mysql.migrations index 603060aa2..1cb8a087c 100644 --- a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/idx_mysql.migrations +++ b/ebean-ddl-generator/src/test/resources/mysql/procedures/mysql/idx_mysql.migrations @@ -1,5 +1,4 @@ 1835064798, I__create_procs.sql 1968521526, 1.0__initial.sql -728933533, 1.2__dropsFor_1.1.sql -561281075, R__order_views.sql diff --git a/ebean-kotlin/pom.xml b/ebean-kotlin/pom.xml index 8d6a240c2..b7fd2e89e 100644 --- a/ebean-kotlin/pom.xml +++ b/ebean-kotlin/pom.xml @@ -1,5 +1,7 @@ - + ebean-parent io.ebean diff --git a/ebean-test/pom.xml b/ebean-test/pom.xml index 119716930..bb19f8949 100644 --- a/ebean-test/pom.xml +++ b/ebean-test/pom.xml @@ -113,7 +113,7 @@ io.ebean ebean-dbmigration-runner - 13.2.1-SNAPSHOT + 13.3.0-SNAPSHOT test diff --git a/ebean-test/src/main/java/module-info.java b/ebean-test/src/main/java/module-info.java index a297ce170..10ed1c0a4 100644 --- a/ebean-test/src/main/java/module-info.java +++ b/ebean-test/src/main/java/module-info.java @@ -27,5 +27,4 @@ module io.ebean.test { requires static org.junit.jupiter.api; requires static jdk.management; requires static io.avaje.jsr305x; - requires io.ebean.api; } diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/db2luw/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/db2luw/1.0__initial.sql deleted file mode 100644 index f0fa20f0e..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/db2luw/1.0__initial.sql +++ /dev/null @@ -1,312 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamp, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -) in TESTTS index in TESTTS long in TESTTS; - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -) in TESTTS index in TESTTS long in TESTTS; - -create table migtest_mtm_m ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -) in TSMASTER index in TSMASTER long in TSMASTER; - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -) in TSMASTER index in TSMASTER long in TSMASTER; - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -) in TSMASTER index in TSMASTER long in TSMASTER; - -create table migtest_oto_child ( - id integer generated by default as identity not null, - name varchar(255), - master_id bigint, - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history2 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history2 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history2 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history2 add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history3 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history3 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history3 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history3 add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history4 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history4 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history4 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history4 add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history5 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history5 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history5 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history5 add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history6 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history6 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history6 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history6 add period system_time (sys_period_start,sys_period_end); --- apply post alter -create unique index uq_migtest_e_basic_description on migtest_e_basic(description) exclude null keys; -create unique index uq_migtest_e_basic_status_indextest1 on migtest_e_basic(status,indextest1) exclude null keys; -create unique index uq_migtest_e_basic_name on migtest_e_basic(name) exclude null keys; -create unique index uq_migtest_e_basic_indextest4 on migtest_e_basic(indextest4) exclude null keys; -create unique index uq_migtest_e_basic_indextest5 on migtest_e_basic(indextest5) exclude null keys; -create table migtest_e_history_history ( - id integer not null, - test_string bigint, - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history add versioning use history table migtest_e_history_history; -create table migtest_e_history2_history ( - id integer not null, - test_string varchar(255) not null, - test_string2 varchar(255), - test_string3 varchar(255) not null, - new_column varchar(20), - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history2 add versioning use history table migtest_e_history2_history; -create table migtest_e_history3_history ( - id integer not null, - test_string varchar(255), - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history3 add versioning use history table migtest_e_history3_history; -create table migtest_e_history4_history ( - id integer not null, - test_number bigint, - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history4 add versioning use history table migtest_e_history4_history; -create table migtest_e_history5_history ( - id integer not null, - test_number integer, - test_boolean boolean not null, - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history5 add versioning use history table migtest_e_history5_history; -create table migtest_e_history6_history ( - id integer not null, - test_number1 integer not null, - test_number2 integer, - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history6 add versioning use history table migtest_e_history6_history; -create unique index uq_migtest_oto_child_master_id on migtest_oto_child(master_id) exclude null keys; --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/h2/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/h2/1.0__initial.sql deleted file mode 100644 index d792c3fa2..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/h2/1.0__initial.sql +++ /dev/null @@ -1,306 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamp, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer generated by default as identity not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period_start timestamp default now(); -alter table migtest_e_history add column sys_period_end timestamp; -alter table migtest_e_history2 add column sys_period_start timestamp default now(); -alter table migtest_e_history2 add column sys_period_end timestamp; -alter table migtest_e_history3 add column sys_period_start timestamp default now(); -alter table migtest_e_history3 add column sys_period_end timestamp; -alter table migtest_e_history4 add column sys_period_start timestamp default now(); -alter table migtest_e_history4 add column sys_period_end timestamp; -alter table migtest_e_history5 add column sys_period_start timestamp default now(); -alter table migtest_e_history5 add column sys_period_end timestamp; -alter table migtest_e_history6 add column sys_period_start timestamp default now(); -alter table migtest_e_history6 add column sys_period_end timestamp; --- apply post alter -create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -create trigger migtest_e_history_history_upd before update,delete on migtest_e_history for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history2_history( - id integer, - test_string varchar(255), - test_string2 varchar(255), - test_string3 varchar(255), - new_column varchar(20), - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -create trigger migtest_e_history2_history_upd before update,delete on migtest_e_history2 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -create trigger migtest_e_history3_history_upd before update,delete on migtest_e_history3 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history4_history( - id integer, - test_number bigint, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -create trigger migtest_e_history4_history_upd before update,delete on migtest_e_history4 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history5_history( - id integer, - test_number integer, - test_boolean boolean, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -create trigger migtest_e_history5_history_upd before update,delete on migtest_e_history5 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -create trigger migtest_e_history6_history_upd before update,delete on migtest_e_history6 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/hana/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/hana/1.0__initial.sql deleted file mode 100644 index e61249fe0..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/hana/1.0__initial.sql +++ /dev/null @@ -1,312 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create column table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one nvarchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create column table migtest_ckey_detail ( - id integer generated by default as identity not null, - something nvarchar(255), - one_key integer, - two_key nvarchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create column table migtest_ckey_parent ( - one_key integer not null, - two_key nvarchar(127) not null, - name nvarchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create column table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create column table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create column table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create column table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create column table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create column table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create column table migtest_e_basic ( - id integer generated by default as identity not null, - status nvarchar(1) default 'A' not null, - status2 nvarchar(127), - name nvarchar(127), - description nvarchar(127), - some_date timestamp, - new_string_field nvarchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 nvarchar(127), - indextest2 nvarchar(127), - indextest3 nvarchar(127), - indextest4 nvarchar(127), - indextest5 nvarchar(127), - indextest6 nvarchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create column table migtest_e_enum ( - id integer generated by default as identity not null, - test_status nvarchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create column table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create column table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string nvarchar(255) default 'unknown' not null, - test_string2 nvarchar(255), - test_string3 nvarchar(255) default 'unknown' not null, - new_column nvarchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create column table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string nvarchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create column table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create column table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create column table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create column table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string nvarchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create column table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create column table migtest_mtm_c ( - id integer generated by default as identity not null, - name nvarchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create column table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create column table migtest_mtm_m ( - id bigint generated by default as identity not null, - name nvarchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create column table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create column table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value nvarchar(255) not null -); - -create column table migtest_oto_child ( - id integer generated by default as identity not null, - name nvarchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create column table migtest_oto_master ( - id bigint generated by default as identity not null, - name nvarchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables --- apply post alter -create column table migtest_e_history_history ( - id integer, - test_string bigint, - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history add system versioning history table migtest_e_history_history; -create column table migtest_e_history2_history ( - id integer, - test_string nvarchar(255) default 'unknown' not null, - test_string2 nvarchar(255), - test_string3 nvarchar(255) default 'unknown' not null, - new_column nvarchar(20), - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history2 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history2 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history2 add system versioning history table migtest_e_history2_history; -create column table migtest_e_history3_history ( - id integer, - test_string nvarchar(255), - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history3 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history3 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history3 add system versioning history table migtest_e_history3_history; -create column table migtest_e_history4_history ( - id integer, - test_number bigint, - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history4 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history4 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history4 add system versioning history table migtest_e_history4_history; -create column table migtest_e_history5_history ( - id integer, - test_number integer, - test_boolean boolean default false not null, - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history5 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history5 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history5 add system versioning history table migtest_e_history5_history; -create column table migtest_e_history6_history ( - id integer, - test_number1 integer default 42 not null, - test_number2 integer, - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history6 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history6 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history6 add system versioning history table migtest_e_history6_history; --- foreign keys and indices -create inverted hash index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - --- explicit index "ix_migtest_ckey_parent_assoc_id" for single column "assoc_id" of table "migtest_ckey_parent" is not necessary; -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_fk_cascade_one_id" for single column "one_id" of table "migtest_fk_cascade" is not necessary; -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_fk_none_one_id" for single column "one_id" of table "migtest_fk_none" is not necessary; -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_fk_none_via_join_one_id" for single column "one_id" of table "migtest_fk_none_via_join" is not necessary; -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_fk_set_null_one_id" for single column "one_id" of table "migtest_fk_set_null" is not necessary; -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; - --- explicit index "ix_migtest_e_basic_user_id" for single column "user_id" of table "migtest_e_basic" is not necessary; -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - --- explicit index "ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m" for single column "migtest_mtm_m_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_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m" for single column "migtest_mtm_m_id" of table "migtest_mtm_m_migtest_mtm_c" is not necessary; -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c" for single column "migtest_mtm_c_id" of table "migtest_mtm_m_migtest_mtm_c" is not necessary; -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id" for single column "migtest_mtm_m_id" of table "migtest_mtm_m_phone_numbers" is not necessary; -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_e_basic_indextest3" for single column "indextest3" of table "migtest_e_basic" is not necessary; --- explicit index "ix_migtest_e_basic_indextest6" for single column "indextest6" of table "migtest_e_basic" is not necessary; diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/hsqldb/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/hsqldb/1.0__initial.sql deleted file mode 100644 index aabebada9..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/hsqldb/1.0__initial.sql +++ /dev/null @@ -1,233 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity (start with 1) not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity (start with 1) not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity (start with 1) not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity (start with 1) not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity (start with 1) not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity (start with 1) not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity (start with 1) not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity (start with 1) not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity (start with 1) not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamp, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity (start with 1) not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity (start with 1) not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity (start with 1) not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity (start with 1) not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity (start with 1) not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity (start with 1) not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity (start with 1) not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity (start with 1) not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity (start with 1) not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity (start with 1) not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint generated by default as identity (start with 1) not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer generated by default as identity (start with 1) not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity (start with 1) not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/mariadb/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/mariadb/1.0__initial.sql deleted file mode 100644 index dd7cae250..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/mariadb/1.0__initial.sql +++ /dev/null @@ -1,236 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer auto_increment not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer auto_increment not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer auto_increment not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date datetime(6), - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field tinyint(1) default 1 not null, - new_boolean_field2 tinyint(1) default 1 not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer auto_increment not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer auto_increment not null, - test_string bigint comment 'Column altered to long now', - constraint pk_migtest_e_history primary key (id) -) comment='We have history now'; - -create table migtest_e_history2 ( - id integer auto_increment not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer auto_increment not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer auto_increment not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer auto_increment not null, - test_number integer, - test_boolean tinyint(1) default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer auto_increment not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer auto_increment not null, - test_string varchar(255), - deleted tinyint(1) default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer auto_increment not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer auto_increment not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add system versioning; -alter table migtest_e_history2 add system versioning; -alter table migtest_e_history3 add system versioning; -alter table migtest_e_history4 add system versioning; -alter table migtest_e_history5 add system versioning; -alter table migtest_e_history6 add system versioning; --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/mysql/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/mysql/1.0__initial.sql deleted file mode 100644 index 4a3ad7249..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/mysql/1.0__initial.sql +++ /dev/null @@ -1,362 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer auto_increment not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer auto_increment not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer auto_increment not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date datetime(6), - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field tinyint(1) default 1 not null, - new_boolean_field2 tinyint(1) default 1 not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer auto_increment not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer auto_increment not null, - test_string bigint comment 'Column altered to long now', - constraint pk_migtest_e_history primary key (id) -) comment='We have history now'; - -create table migtest_e_history2 ( - id integer auto_increment not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer auto_increment not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer auto_increment not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer auto_increment not null, - test_number integer, - test_boolean tinyint(1) default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer auto_increment not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer auto_increment not null, - test_string varchar(255), - deleted tinyint(1) default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer auto_increment not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer auto_increment not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history add column sys_period_end datetime(6); -alter table migtest_e_history2 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history2 add column sys_period_end datetime(6); -alter table migtest_e_history3 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history3 add column sys_period_end datetime(6); -alter table migtest_e_history4 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history4 add column sys_period_end datetime(6); -alter table migtest_e_history5 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history5 add column sys_period_end datetime(6); -alter table migtest_e_history6 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history6 add column sys_period_end datetime(6); --- apply post alter -create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -lock tables migtest_e_history write; -delimiter $$ -create trigger migtest_e_history_history_upd before update on migtest_e_history for each row begin - insert into migtest_e_history_history (sys_period_start,sys_period_end,id, test_string) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history_history_del before delete on migtest_e_history for each row begin - insert into migtest_e_history_history (sys_period_start,sys_period_end,id, test_string) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string); -end$$ -unlock tables; - -create table migtest_e_history2_history( - id integer, - test_string varchar(255), - test_string2 varchar(255), - test_string3 varchar(255), - new_column varchar(20), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -lock tables migtest_e_history2 write; -delimiter $$ -create trigger migtest_e_history2_history_upd before update on migtest_e_history2 for each row begin - insert into migtest_e_history2_history (sys_period_start,sys_period_end,id, test_string, test_string3, new_column) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history2_history_del before delete on migtest_e_history2 for each row begin - insert into migtest_e_history2_history (sys_period_start,sys_period_end,id, test_string, test_string3, new_column) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); -end$$ -unlock tables; - -create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -lock tables migtest_e_history3 write; -delimiter $$ -create trigger migtest_e_history3_history_upd before update on migtest_e_history3 for each row begin - insert into migtest_e_history3_history (sys_period_start,sys_period_end,id) values (OLD.sys_period_start, now(6),OLD.id); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history3_history_del before delete on migtest_e_history3 for each row begin - insert into migtest_e_history3_history (sys_period_start,sys_period_end,id) values (OLD.sys_period_start, now(6),OLD.id); -end$$ -unlock tables; - -create table migtest_e_history4_history( - id integer, - test_number bigint, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -lock tables migtest_e_history4 write; -delimiter $$ -create trigger migtest_e_history4_history_upd before update on migtest_e_history4 for each row begin - insert into migtest_e_history4_history (sys_period_start,sys_period_end,id, test_number) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history4_history_del before delete on migtest_e_history4 for each row begin - insert into migtest_e_history4_history (sys_period_start,sys_period_end,id, test_number) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number); -end$$ -unlock tables; - -create table migtest_e_history5_history( - id integer, - test_number integer, - test_boolean tinyint(1), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -lock tables migtest_e_history5 write; -delimiter $$ -create trigger migtest_e_history5_history_upd before update on migtest_e_history5 for each row begin - insert into migtest_e_history5_history (sys_period_start,sys_period_end,id, test_number, test_boolean) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number, OLD.test_boolean); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history5_history_del before delete on migtest_e_history5 for each row begin - insert into migtest_e_history5_history (sys_period_start,sys_period_end,id, test_number, test_boolean) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number, OLD.test_boolean); -end$$ -unlock tables; - -create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -lock tables migtest_e_history6 write; -delimiter $$ -create trigger migtest_e_history6_history_upd before update on migtest_e_history6 for each row begin - insert into migtest_e_history6_history (sys_period_start,sys_period_end,id, test_number1, test_number2) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number1, OLD.test_number2); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history6_history_del before delete on migtest_e_history6 for each row begin - insert into migtest_e_history6_history (sys_period_start,sys_period_end,id, test_number1, test_number2) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number1, OLD.test_number2); -end$$ -unlock tables; - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/mysql55/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/mysql55/1.0__initial.sql deleted file mode 100644 index 3a1f8d7ae..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/mysql55/1.0__initial.sql +++ /dev/null @@ -1,362 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer auto_increment not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer auto_increment not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer auto_increment not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date datetime, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field tinyint(1) default 1 not null, - new_boolean_field2 tinyint(1) default 1 not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer auto_increment not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer auto_increment not null, - test_string bigint comment 'Column altered to long now', - constraint pk_migtest_e_history primary key (id) -) comment='We have history now'; - -create table migtest_e_history2 ( - id integer auto_increment not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer auto_increment not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer auto_increment not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer auto_increment not null, - test_number integer, - test_boolean tinyint(1) default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer auto_increment not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer auto_increment not null, - test_string varchar(255), - deleted tinyint(1) default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer auto_increment not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer auto_increment not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history add column sys_period_end datetime(6); -alter table migtest_e_history2 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history2 add column sys_period_end datetime(6); -alter table migtest_e_history3 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history3 add column sys_period_end datetime(6); -alter table migtest_e_history4 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history4 add column sys_period_end datetime(6); -alter table migtest_e_history5 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history5 add column sys_period_end datetime(6); -alter table migtest_e_history6 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history6 add column sys_period_end datetime(6); --- apply post alter -create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -lock tables migtest_e_history write; -delimiter $$ -create trigger migtest_e_history_history_upd before update on migtest_e_history for each row begin - insert into migtest_e_history_history (sys_period_start,sys_period_end,id, test_string) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history_history_del before delete on migtest_e_history for each row begin - insert into migtest_e_history_history (sys_period_start,sys_period_end,id, test_string) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string); -end$$ -unlock tables; - -create table migtest_e_history2_history( - id integer, - test_string varchar(255), - test_string2 varchar(255), - test_string3 varchar(255), - new_column varchar(20), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -lock tables migtest_e_history2 write; -delimiter $$ -create trigger migtest_e_history2_history_upd before update on migtest_e_history2 for each row begin - insert into migtest_e_history2_history (sys_period_start,sys_period_end,id, test_string, test_string3, new_column) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history2_history_del before delete on migtest_e_history2 for each row begin - insert into migtest_e_history2_history (sys_period_start,sys_period_end,id, test_string, test_string3, new_column) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); -end$$ -unlock tables; - -create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -lock tables migtest_e_history3 write; -delimiter $$ -create trigger migtest_e_history3_history_upd before update on migtest_e_history3 for each row begin - insert into migtest_e_history3_history (sys_period_start,sys_period_end,id) values (OLD.sys_period_start, now(6),OLD.id); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history3_history_del before delete on migtest_e_history3 for each row begin - insert into migtest_e_history3_history (sys_period_start,sys_period_end,id) values (OLD.sys_period_start, now(6),OLD.id); -end$$ -unlock tables; - -create table migtest_e_history4_history( - id integer, - test_number bigint, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -lock tables migtest_e_history4 write; -delimiter $$ -create trigger migtest_e_history4_history_upd before update on migtest_e_history4 for each row begin - insert into migtest_e_history4_history (sys_period_start,sys_period_end,id, test_number) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history4_history_del before delete on migtest_e_history4 for each row begin - insert into migtest_e_history4_history (sys_period_start,sys_period_end,id, test_number) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number); -end$$ -unlock tables; - -create table migtest_e_history5_history( - id integer, - test_number integer, - test_boolean tinyint(1), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -lock tables migtest_e_history5 write; -delimiter $$ -create trigger migtest_e_history5_history_upd before update on migtest_e_history5 for each row begin - insert into migtest_e_history5_history (sys_period_start,sys_period_end,id, test_number, test_boolean) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number, OLD.test_boolean); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history5_history_del before delete on migtest_e_history5 for each row begin - insert into migtest_e_history5_history (sys_period_start,sys_period_end,id, test_number, test_boolean) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number, OLD.test_boolean); -end$$ -unlock tables; - -create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -lock tables migtest_e_history6 write; -delimiter $$ -create trigger migtest_e_history6_history_upd before update on migtest_e_history6 for each row begin - insert into migtest_e_history6_history (sys_period_start,sys_period_end,id, test_number1, test_number2) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number1, OLD.test_number2); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history6_history_del before delete on migtest_e_history6 for each row begin - insert into migtest_e_history6_history (sys_period_start,sys_period_end,id, test_number1, test_number2) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number1, OLD.test_number2); -end$$ -unlock tables; - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/oracle/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/oracle/1.0__initial.sql deleted file mode 100644 index 5d8d0b76e..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/oracle/1.0__initial.sql +++ /dev/null @@ -1,233 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id number(10) generated by default as identity not null, - assoc_one varchar2(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id number(10) generated by default as identity not null, - something varchar2(255), - one_key number(10), - two_key varchar2(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key number(10) not null, - two_key varchar2(127) not null, - name varchar2(255), - assoc_id number(10), - version number(10) not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id number(19) generated by default as identity not null, - one_id number(19), - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id number(19) generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id number(19) generated by default as identity not null, - one_id number(19), - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id number(19) generated by default as identity not null, - one_id number(19), - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id number(19) generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id number(19) generated by default as identity not null, - one_id number(19), - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id number(10) generated by default as identity not null, - status varchar2(1) default 'A' not null, - status2 varchar2(127), - name varchar2(127), - description varchar2(127), - some_date timestamp, - new_string_field varchar2(255) default 'foo''bar' not null, - new_boolean_field number(1) default 1 not null, - new_boolean_field2 number(1) default 1 not null, - indextest1 varchar2(127), - indextest2 varchar2(127), - indextest3 varchar2(127), - indextest4 varchar2(127), - indextest5 varchar2(127), - indextest6 varchar2(127), - progress number(10) default 0 not null, - new_integer number(10) default 42 not null, - user_id number(10), - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id number(10) generated by default as identity not null, - test_status varchar2(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id number(10) generated by default as identity not null, - test_string number(19), - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id number(10) generated by default as identity not null, - test_string varchar2(255) default 'unknown' not null, - test_string2 varchar2(255), - test_string3 varchar2(255) default 'unknown' not null, - new_column varchar2(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id number(10) generated by default as identity not null, - test_string varchar2(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id number(10) generated by default as identity not null, - test_number number(19), - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id number(10) generated by default as identity not null, - test_number number(10), - test_boolean number(1) default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id number(10) generated by default as identity not null, - test_number1 number(10) default 42 not null, - test_number2 number(10), - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id number(10) generated by default as identity not null, - test_string varchar2(255), - deleted number(1) default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id number(10) generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id number(10) generated by default as identity not null, - name varchar2(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id number(10) not null, - migtest_mtm_m_id number(19) not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id number(19) generated by default as identity not null, - name varchar2(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id number(19) not null, - migtest_mtm_c_id number(10) not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id number(19) not null, - value varchar2(255) not null -); - -create table migtest_oto_child ( - id number(10) generated by default as identity not null, - name varchar2(255), - master_id number(19), - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id number(19) generated by default as identity not null, - name varchar2(255), - constraint pk_migtest_oto_master primary key (id) -); - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key); - -create index ix_mgtst_cky_prnt_ssc_d on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_mgtst_cky_prnt_ssc_d foreign key (assoc_id) references migtest_ckey_assoc (id); - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id); - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id); - -create index ix_mgtst_fk_nn_v_jn_n_d on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_mgtst_fk_nn_v_jn_n_d foreign key (one_id) references migtest_fk_one (id); - -create index ix_migtest_fk_set_null_one_id on 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); - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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); - -create index ix_mgtst_mtm_c_mgtst_mt_3ug4ou on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_mgtst_mtm_c_mgtst_mt_93awgk foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -create index ix_mgtst_mtm_m_mgtst_mt_b7nbcu on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_mgtst_mtm_m_mgtst_mt_ggi34k foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -create index ix_mgtst_mtm_m_mgtst_mt_b7nbck on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_mgtst_mtm_m_mgtst_mt_ggi34a foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); - -create index ix_mgtst_mtm_m_phn_nmbr_do9ma3 on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_mgtst_mtm_m_phn_nmbr_s8neid foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id); - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/postgres/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/postgres/1.0__initial.sql deleted file mode 100644 index b22dc2127..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/postgres/1.0__initial.sql +++ /dev/null @@ -1,392 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamptz, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer generated by default as identity not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history2 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history3 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history4 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history5 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history6 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); --- apply post alter -create table migtest_e_history_history(like migtest_e_history); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -create or replace function migtest_e_history_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history_history (sys_period,id, test_string) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history_history (sys_period,id, test_string) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history_history_upd - before update or delete on migtest_e_history - for each row execute procedure migtest_e_history_history_version(); - - -create table migtest_e_history2_history(like migtest_e_history2); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -create or replace function migtest_e_history2_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history2_history (sys_period,id, test_string, test_string3, new_column) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history2_history (sys_period,id, test_string, test_string3, new_column) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history2_history_upd - before update or delete on migtest_e_history2 - for each row execute procedure migtest_e_history2_history_version(); - - -create table migtest_e_history3_history(like migtest_e_history3); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -create or replace function migtest_e_history3_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history3_history (sys_period,id) values (tstzrange(lowerTs,upperTs), OLD.id); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history3_history (sys_period,id) values (tstzrange(lowerTs,upperTs), OLD.id); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history3_history_upd - before update or delete on migtest_e_history3 - for each row execute procedure migtest_e_history3_history_version(); - - -create table migtest_e_history4_history(like migtest_e_history4); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -create or replace function migtest_e_history4_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history4_history (sys_period,id, test_number) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history4_history (sys_period,id, test_number) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history4_history_upd - before update or delete on migtest_e_history4 - for each row execute procedure migtest_e_history4_history_version(); - - -create table migtest_e_history5_history(like migtest_e_history5); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -create or replace function migtest_e_history5_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history5_history (sys_period,id, test_number, test_boolean) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number, OLD.test_boolean); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history5_history (sys_period,id, test_number, test_boolean) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number, OLD.test_boolean); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history5_history_upd - before update or delete on migtest_e_history5 - for each row execute procedure migtest_e_history5_history_version(); - - -create table migtest_e_history6_history(like migtest_e_history6); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -create or replace function migtest_e_history6_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history6_history (sys_period,id, test_number1, test_number2) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number1, OLD.test_number2); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history6_history (sys_period,id, test_number1, test_number2) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number1, OLD.test_number2); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history6_history_upd - before update or delete on migtest_e_history6 - for each row execute procedure migtest_e_history6_history_version(); - - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index if not exists ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index if not exists ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); -create index if not exists ix_migtest_oto_child_name on migtest_oto_child (name); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/sqlite/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/sqlite/1.0__initial.sql deleted file mode 100644 index 6ff6d8ceb..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/sqlite/1.0__initial.sql +++ /dev/null @@ -1,206 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id), - foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key), - foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict -); - -create table migtest_fk_cascade ( - id integer not null, - one_id integer, - constraint pk_migtest_fk_cascade primary key (id), - foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict -); - -create table migtest_fk_cascade_one ( - id integer not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id integer not null, - one_id integer, - constraint pk_migtest_fk_none primary key (id), - foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict -); - -create table migtest_fk_none_via_join ( - id integer not null, - one_id integer, - constraint pk_migtest_fk_none_via_join primary key (id), - foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict -); - -create table migtest_fk_one ( - id integer not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id integer not null, - one_id integer, - constraint pk_migtest_fk_set_null primary key (id), - foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict -); - -create table migtest_e_basic ( - id integer not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamp, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field int default 1 not null, - new_boolean_field2 int default 1 not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id), - foreign key (user_id) references migtest_e_user (id) on delete restrict on update restrict -); - -create table migtest_e_enum ( - id integer not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer not null, - test_string integer, - constraint pk_migtest_e_history primary key (id) -); - -create table migtest_e_history2 ( - id integer not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer not null, - test_number integer, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer not null, - test_number integer, - test_boolean int default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer not null, - test_string varchar(255), - deleted int default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id integer not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id), - foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict, - foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict -); - -create table migtest_mtm_m ( - id integer not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id integer not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id), - foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict, - foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id integer not null, - value varchar(255) not null, - foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict -); - -create table migtest_oto_child ( - id integer not null, - name varchar(255), - master_id integer, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id), - foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict -); - -create table migtest_oto_master ( - id integer not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- foreign keys and indices -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/sqlserver17/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/sqlserver17/1.0__initial.sql deleted file mode 100644 index d4934452b..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/sqlserver17/1.0__initial.sql +++ /dev/null @@ -1,284 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer not null, - assoc_one nvarchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); -create sequence migtest_ckey_assoc_seq as bigint start with 1; - -create table migtest_ckey_detail ( - id integer not null, - something nvarchar(255), - one_key integer, - two_key nvarchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); -create sequence migtest_ckey_detail_seq as bigint start with 1; - -create table migtest_ckey_parent ( - one_key integer not null, - two_key nvarchar(127) not null, - name nvarchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id numeric(19) not null, - one_id numeric(19), - constraint pk_migtest_fk_cascade primary key (id) -); -create sequence migtest_fk_cascade_seq as bigint start with 1; - -create table migtest_fk_cascade_one ( - id numeric(19) not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); -create sequence migtest_fk_cascade_one_seq as bigint start with 1; - -create table migtest_fk_none ( - id numeric(19) not null, - one_id numeric(19), - constraint pk_migtest_fk_none primary key (id) -); -create sequence migtest_fk_none_seq as bigint start with 1; - -create table migtest_fk_none_via_join ( - id numeric(19) not null, - one_id numeric(19), - constraint pk_migtest_fk_none_via_join primary key (id) -); -create sequence migtest_fk_none_via_join_seq as bigint start with 1; - -create table migtest_fk_one ( - id numeric(19) not null, - constraint pk_migtest_fk_one primary key (id) -); -create sequence migtest_fk_one_seq as bigint start with 1; - -create table migtest_fk_set_null ( - id numeric(19) not null, - one_id numeric(19), - constraint pk_migtest_fk_set_null primary key (id) -); -create sequence migtest_fk_set_null_seq as bigint start with 1; - -create table migtest_e_basic ( - id integer not null, - status nvarchar(1) default 'A' not null, - status2 nvarchar(127), - name nvarchar(127), - description nvarchar(127), - some_date datetime2, - new_string_field nvarchar(255) default 'foo''bar' not null, - new_boolean_field bit default 1 not null, - new_boolean_field2 bit default 1 not null, - indextest1 nvarchar(127), - indextest2 nvarchar(127), - indextest3 nvarchar(127), - indextest4 nvarchar(127), - indextest5 nvarchar(127), - indextest6 nvarchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint pk_migtest_e_basic primary key (id) -); -create sequence migtest_e_basic_seq as bigint start with 1; - -create table migtest_e_enum ( - id integer not null, - test_status nvarchar(1), - constraint pk_migtest_e_enum primary key (id) -); -create sequence migtest_e_enum_seq as bigint start with 1; - -create table migtest_e_history ( - id integer not null, - test_string numeric(19), - constraint pk_migtest_e_history primary key (id) -); -create sequence migtest_e_history_seq as bigint start with 1; - -create table migtest_e_history2 ( - id integer not null, - test_string nvarchar(255) default 'unknown' not null, - test_string2 nvarchar(255), - test_string3 nvarchar(255) default 'unknown' not null, - new_column nvarchar(20), - constraint pk_migtest_e_history2 primary key (id) -); -create sequence migtest_e_history2_seq as bigint start with 1; - -create table migtest_e_history3 ( - id integer not null, - test_string nvarchar(255), - constraint pk_migtest_e_history3 primary key (id) -); -create sequence migtest_e_history3_seq as bigint start with 1; - -create table migtest_e_history4 ( - id integer not null, - test_number numeric(19), - constraint pk_migtest_e_history4 primary key (id) -); -create sequence migtest_e_history4_seq as bigint start with 1; - -create table migtest_e_history5 ( - id integer not null, - test_number integer, - test_boolean bit default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); -create sequence migtest_e_history5_seq as bigint start with 1; - -create table migtest_e_history6 ( - id integer not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); -create sequence migtest_e_history6_seq as bigint start with 1; - -create table migtest_e_softdelete ( - id integer not null, - test_string nvarchar(255), - deleted bit default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); -create sequence migtest_e_softdelete_seq as bigint start with 1; - -create table migtest_e_user ( - id integer not null, - constraint pk_migtest_e_user primary key (id) -); -create sequence migtest_e_user_seq as bigint start with 1; - -create table migtest_mtm_c ( - id integer not null, - name nvarchar(255), - constraint pk_migtest_mtm_c primary key (id) -); -create sequence migtest_mtm_c_seq as bigint start with 1; - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id numeric(19) not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id numeric(19) not null, - name nvarchar(255), - constraint pk_migtest_mtm_m primary key (id) -); -create sequence migtest_mtm_m_seq as bigint start with 1; - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id numeric(19) not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id numeric(19) not null, - value nvarchar(255) not null -); - -create table migtest_oto_child ( - id integer not null, - name nvarchar(255), - master_id numeric(19), - constraint pk_migtest_oto_child primary key (id) -); -create sequence migtest_oto_child_seq as bigint start with 1; - -create table migtest_oto_master ( - id numeric(19) not null, - name nvarchar(255), - constraint pk_migtest_oto_master primary key (id) -); -create sequence migtest_oto_master_seq as bigint start with 1; - --- apply post alter -create unique nonclustered index uq_migtest_e_basic_description on migtest_e_basic(description) where description is not null; -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; -alter table migtest_e_history - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history set (system_versioning = on (history_table=dbo.migtest_e_history_history)); -alter table migtest_e_history2 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history2 set (system_versioning = on (history_table=dbo.migtest_e_history2_history)); -alter table migtest_e_history3 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history3 set (system_versioning = on (history_table=dbo.migtest_e_history3_history)); -alter table migtest_e_history4 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history4 set (system_versioning = on (history_table=dbo.migtest_e_history4_history)); -alter table migtest_e_history5 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history5 set (system_versioning = on (history_table=dbo.migtest_e_history5_history)); -alter table migtest_e_history6 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history6 set (system_versioning = on (history_table=dbo.migtest_e_history6_history)); -create unique nonclustered index uq_migtest_oto_child_master_id on migtest_oto_child(master_id) where master_id is not null; --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key); - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id); - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id); - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id); - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id); - -create index ix_migtest_fk_set_null_one_id on 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); - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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); - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id); - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbinit/yugabyte/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbinit/yugabyte/1.0__initial.sql deleted file mode 100644 index bef57d682..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbinit/yugabyte/1.0__initial.sql +++ /dev/null @@ -1,420 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamptz, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer generated by default as identity not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history2 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history3 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history4 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history5 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history6 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); --- apply post alter -create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period tstzrange -); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -create or replace function migtest_e_history_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history_history (sys_period,id, test_string) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history_history (sys_period,id, test_string) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history_history_upd - before update or delete on migtest_e_history - for each row execute procedure migtest_e_history_history_version(); - - -create table migtest_e_history2_history( - id integer, - test_string varchar(255), - test_string2 varchar(255), - test_string3 varchar(255), - new_column varchar(20), - sys_period tstzrange -); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -create or replace function migtest_e_history2_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history2_history (sys_period,id, test_string, test_string3, new_column) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history2_history (sys_period,id, test_string, test_string3, new_column) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history2_history_upd - before update or delete on migtest_e_history2 - for each row execute procedure migtest_e_history2_history_version(); - - -create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period tstzrange -); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -create or replace function migtest_e_history3_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history3_history (sys_period,id) values (tstzrange(lowerTs,upperTs), OLD.id); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history3_history (sys_period,id) values (tstzrange(lowerTs,upperTs), OLD.id); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history3_history_upd - before update or delete on migtest_e_history3 - for each row execute procedure migtest_e_history3_history_version(); - - -create table migtest_e_history4_history( - id integer, - test_number bigint, - sys_period tstzrange -); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -create or replace function migtest_e_history4_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history4_history (sys_period,id, test_number) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history4_history (sys_period,id, test_number) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history4_history_upd - before update or delete on migtest_e_history4 - for each row execute procedure migtest_e_history4_history_version(); - - -create table migtest_e_history5_history( - id integer, - test_number integer, - test_boolean boolean, - sys_period tstzrange -); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -create or replace function migtest_e_history5_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history5_history (sys_period,id, test_number, test_boolean) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number, OLD.test_boolean); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history5_history (sys_period,id, test_number, test_boolean) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number, OLD.test_boolean); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history5_history_upd - before update or delete on migtest_e_history5 - for each row execute procedure migtest_e_history5_history_version(); - - -create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period tstzrange -); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -create or replace function migtest_e_history6_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history6_history (sys_period,id, test_number1, test_number2) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number1, OLD.test_number2); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history6_history (sys_period,id, test_number1, test_number2) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number1, OLD.test_number2); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history6_history_upd - before update or delete on migtest_e_history6 - for each row execute procedure migtest_e_history6_history_version(); - - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index if not exists ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index if not exists ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql deleted file mode 100644 index f0fa20f0e..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql +++ /dev/null @@ -1,312 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamp, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -) in TESTTS index in TESTTS long in TESTTS; - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -) in TESTTS index in TESTTS long in TESTTS; - -create table migtest_mtm_m ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -) in TSMASTER index in TSMASTER long in TSMASTER; - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -) in TSMASTER index in TSMASTER long in TSMASTER; - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -) in TSMASTER index in TSMASTER long in TSMASTER; - -create table migtest_oto_child ( - id integer generated by default as identity not null, - name varchar(255), - master_id bigint, - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history2 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history2 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history2 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history2 add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history3 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history3 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history3 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history3 add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history4 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history4 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history4 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history4 add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history5 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history5 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history5 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history5 add period system_time (sys_period_start,sys_period_end); -alter table migtest_e_history6 add column sys_period_start timestamp(12) not null generated always as row begin; -alter table migtest_e_history6 add column sys_period_end timestamp(12) not null generated always as row end; -alter table migtest_e_history6 add column sys_period_txn timestamp(12) generated always as transaction start id; -alter table migtest_e_history6 add period system_time (sys_period_start,sys_period_end); --- apply post alter -create unique index uq_migtest_e_basic_description on migtest_e_basic(description) exclude null keys; -create unique index uq_migtest_e_basic_status_indextest1 on migtest_e_basic(status,indextest1) exclude null keys; -create unique index uq_migtest_e_basic_name on migtest_e_basic(name) exclude null keys; -create unique index uq_migtest_e_basic_indextest4 on migtest_e_basic(indextest4) exclude null keys; -create unique index uq_migtest_e_basic_indextest5 on migtest_e_basic(indextest5) exclude null keys; -create table migtest_e_history_history ( - id integer not null, - test_string bigint, - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history add versioning use history table migtest_e_history_history; -create table migtest_e_history2_history ( - id integer not null, - test_string varchar(255) not null, - test_string2 varchar(255), - test_string3 varchar(255) not null, - new_column varchar(20), - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history2 add versioning use history table migtest_e_history2_history; -create table migtest_e_history3_history ( - id integer not null, - test_string varchar(255), - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history3 add versioning use history table migtest_e_history3_history; -create table migtest_e_history4_history ( - id integer not null, - test_number bigint, - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history4 add versioning use history table migtest_e_history4_history; -create table migtest_e_history5_history ( - id integer not null, - test_number integer, - test_boolean boolean not null, - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history5 add versioning use history table migtest_e_history5_history; -create table migtest_e_history6_history ( - id integer not null, - test_number1 integer not null, - test_number2 integer, - sys_period_start timestamp(12) not null, - sys_period_end timestamp(12) not null, - sys_period_txn timestamp(12) -); -alter table migtest_e_history6 add versioning use history table migtest_e_history6_history; -create unique index uq_migtest_oto_child_master_id on migtest_oto_child(master_id) exclude null keys; --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/I__create_tablespaces.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/I__create_tablespaces.sql deleted file mode 100644 index e118fc1a1..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/I__create_tablespaces.sql +++ /dev/null @@ -1,29 +0,0 @@ - -delimiter $$ -BEGIN -IF (NOT exists (SELECT * FROM SYSIBM.SYSTABLESPACES WHERE TBSPACE = 'TSTABLES')) THEN -EXECUTE IMMEDIATE 'CREATE TABLESPACE "TSTABLES"'; -END IF; -END -$$ -delimiter $$ -BEGIN -IF (NOT exists (SELECT * FROM SYSIBM.SYSTABLESPACES WHERE TBSPACE = 'INDEXTS')) -THEN EXECUTE IMMEDIATE 'CREATE TABLESPACE "INDEXTS"'; -END IF; -END -$$ -delimiter $$ -BEGIN -IF (NOT exists (SELECT * FROM SYSIBM.SYSTABLESPACES WHERE TBSPACE = 'TESTTS')) THEN -EXECUTE IMMEDIATE 'CREATE TABLESPACE "TESTTS"'; -END IF; -END -$$ -delimiter $$ -BEGIN -IF (NOT exists (SELECT * FROM SYSIBM.SYSTABLESPACES WHERE TBSPACE = 'TSMASTER')) THEN -EXECUTE IMMEDIATE 'CREATE TABLESPACE "TSMASTER"'; -END IF; -END -$$ diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/R__db2_explain_tables.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/R__db2_explain_tables.sql deleted file mode 100644 index b2539a5ea..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/R__db2_explain_tables.sql +++ /dev/null @@ -1,8 +0,0 @@ - -delimiter $$ -BEGIN -IF NOT EXISTS (SELECT * FROM SYSCAT.TABLES WHERE TABSCHEMA = CURRENT SCHEMA AND TABNAME = 'EXPLAIN_STREAM') THEN -call SYSPROC.SYSINSTALLOBJECTS( 'EXPLAIN', 'C' , '', CURRENT SCHEMA ); -END IF; -END;$$ - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/R__order_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations deleted file mode 100644 index c4799d684..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations +++ /dev/null @@ -1,5 +0,0 @@ --1602289007, I__create_tablespaces.sql --1178292807, 1.0__initial.sql --133543359, R__db2_explain_tables.sql -561281075, R__order_views.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/h2/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/h2/1.0__initial.sql deleted file mode 100644 index d792c3fa2..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/h2/1.0__initial.sql +++ /dev/null @@ -1,306 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamp, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer generated by default as identity not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period_start timestamp default now(); -alter table migtest_e_history add column sys_period_end timestamp; -alter table migtest_e_history2 add column sys_period_start timestamp default now(); -alter table migtest_e_history2 add column sys_period_end timestamp; -alter table migtest_e_history3 add column sys_period_start timestamp default now(); -alter table migtest_e_history3 add column sys_period_end timestamp; -alter table migtest_e_history4 add column sys_period_start timestamp default now(); -alter table migtest_e_history4 add column sys_period_end timestamp; -alter table migtest_e_history5 add column sys_period_start timestamp default now(); -alter table migtest_e_history5 add column sys_period_end timestamp; -alter table migtest_e_history6 add column sys_period_start timestamp default now(); -alter table migtest_e_history6 add column sys_period_end timestamp; --- apply post alter -create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -create trigger migtest_e_history_history_upd before update,delete on migtest_e_history for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history2_history( - id integer, - test_string varchar(255), - test_string2 varchar(255), - test_string3 varchar(255), - new_column varchar(20), - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -create trigger migtest_e_history2_history_upd before update,delete on migtest_e_history2 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -create trigger migtest_e_history3_history_upd before update,delete on migtest_e_history3 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history4_history( - id integer, - test_number bigint, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -create trigger migtest_e_history4_history_upd before update,delete on migtest_e_history4 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history5_history( - id integer, - test_number integer, - test_boolean boolean, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -create trigger migtest_e_history5_history_upd before update,delete on migtest_e_history5 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - -create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -create trigger migtest_e_history6_history_upd before update,delete on migtest_e_history6 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/h2/R__multi_comments.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/h2/R__multi_comments.sql deleted file mode 100644 index 0ede0c9eb..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/h2/R__multi_comments.sql +++ /dev/null @@ -1,3 +0,0 @@ - - -- h2 and postgres script - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/h2/R__order_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/h2/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/h2/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/h2/idx_h2.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/h2/idx_h2.migrations deleted file mode 100644 index 270c90ba5..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/h2/idx_h2.migrations +++ /dev/null @@ -1,4 +0,0 @@ --489443802, 1.0__initial.sql -783227075, R__multi_comments.sql -561281075, R__order_views.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/hana/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/hana/1.0__initial.sql deleted file mode 100644 index e61249fe0..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/hana/1.0__initial.sql +++ /dev/null @@ -1,312 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create column table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one nvarchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create column table migtest_ckey_detail ( - id integer generated by default as identity not null, - something nvarchar(255), - one_key integer, - two_key nvarchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create column table migtest_ckey_parent ( - one_key integer not null, - two_key nvarchar(127) not null, - name nvarchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create column table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create column table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create column table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create column table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create column table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create column table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create column table migtest_e_basic ( - id integer generated by default as identity not null, - status nvarchar(1) default 'A' not null, - status2 nvarchar(127), - name nvarchar(127), - description nvarchar(127), - some_date timestamp, - new_string_field nvarchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 nvarchar(127), - indextest2 nvarchar(127), - indextest3 nvarchar(127), - indextest4 nvarchar(127), - indextest5 nvarchar(127), - indextest6 nvarchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create column table migtest_e_enum ( - id integer generated by default as identity not null, - test_status nvarchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create column table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create column table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string nvarchar(255) default 'unknown' not null, - test_string2 nvarchar(255), - test_string3 nvarchar(255) default 'unknown' not null, - new_column nvarchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create column table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string nvarchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create column table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create column table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create column table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create column table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string nvarchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create column table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create column table migtest_mtm_c ( - id integer generated by default as identity not null, - name nvarchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create column table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create column table migtest_mtm_m ( - id bigint generated by default as identity not null, - name nvarchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create column table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create column table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value nvarchar(255) not null -); - -create column table migtest_oto_child ( - id integer generated by default as identity not null, - name nvarchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create column table migtest_oto_master ( - id bigint generated by default as identity not null, - name nvarchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables --- apply post alter -create column table migtest_e_history_history ( - id integer, - test_string bigint, - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history add system versioning history table migtest_e_history_history; -create column table migtest_e_history2_history ( - id integer, - test_string nvarchar(255) default 'unknown' not null, - test_string2 nvarchar(255), - test_string3 nvarchar(255) default 'unknown' not null, - new_column nvarchar(20), - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history2 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history2 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history2 add system versioning history table migtest_e_history2_history; -create column table migtest_e_history3_history ( - id integer, - test_string nvarchar(255), - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history3 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history3 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history3 add system versioning history table migtest_e_history3_history; -create column table migtest_e_history4_history ( - id integer, - test_number bigint, - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history4 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history4 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history4 add system versioning history table migtest_e_history4_history; -create column table migtest_e_history5_history ( - id integer, - test_number integer, - test_boolean boolean default false not null, - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history5 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history5 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history5 add system versioning history table migtest_e_history5_history; -create column table migtest_e_history6_history ( - id integer, - test_number1 integer default 42 not null, - test_number2 integer, - sys_period_start timestamp, - sys_period_end timestamp -); -alter table migtest_e_history6 add ( - sys_period_start TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW START, - sys_period_end TIMESTAMP NOT NULL GENERATED ALWAYS AS ROW END -); -alter table migtest_e_history6 add period for system_time(sys_period_start,sys_period_end); -alter table migtest_e_history6 add system versioning history table migtest_e_history6_history; --- foreign keys and indices -create inverted hash index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - --- explicit index "ix_migtest_ckey_parent_assoc_id" for single column "assoc_id" of table "migtest_ckey_parent" is not necessary; -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_fk_cascade_one_id" for single column "one_id" of table "migtest_fk_cascade" is not necessary; -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_fk_none_one_id" for single column "one_id" of table "migtest_fk_none" is not necessary; -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_fk_none_via_join_one_id" for single column "one_id" of table "migtest_fk_none_via_join" is not necessary; -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_fk_set_null_one_id" for single column "one_id" of table "migtest_fk_set_null" is not necessary; -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; - --- explicit index "ix_migtest_e_basic_user_id" for single column "user_id" of table "migtest_e_basic" is not necessary; -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - --- explicit index "ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m" for single column "migtest_mtm_m_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_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m" for single column "migtest_mtm_m_id" of table "migtest_mtm_m_migtest_mtm_c" is not necessary; -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c" for single column "migtest_mtm_c_id" of table "migtest_mtm_m_migtest_mtm_c" is not necessary; -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id" for single column "migtest_mtm_m_id" of table "migtest_mtm_m_phone_numbers" is not necessary; -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - --- explicit index "ix_migtest_e_basic_indextest3" for single column "indextest3" of table "migtest_e_basic" is not necessary; --- explicit index "ix_migtest_e_basic_indextest6" for single column "indextest6" of table "migtest_e_basic" is not necessary; diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/hana/I__create_procs.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/hana/I__create_procs.sql deleted file mode 100644 index cec7863ac..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/hana/I__create_procs.sql +++ /dev/null @@ -1,33 +0,0 @@ --- Inital script to create stored procedures etc for the hana platform -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_foreign_keys TABLE, COLUMN --- deletes all constraints and foreign keys referring to TABLE.COLUMN --- -CREATE OR REPLACE PROCEDURE usp_ebean_drop_foreign_keys(IN table_name NVARCHAR(256), IN column_name NVARCHAR(256)) -AS -BEGIN -DECLARE foreign_key_names TABLE(CONSTRAINT_NAME NVARCHAR(256), TABLE_NAME NVARCHAR(256)); -DECLARE i INT; - -foreign_key_names = SELECT CONSTRAINT_NAME, TABLE_NAME FROM SYS.REFERENTIAL_CONSTRAINTS WHERE SCHEMA_NAME=CURRENT_SCHEMA AND TABLE_NAME=UPPER(:table_name) AND COLUMN_NAME=UPPER(:column_name); - -FOR I IN 1 .. RECORD_COUNT(:foreign_key_names) DO -EXEC 'ALTER TABLE "' || ESCAPE_DOUBLE_QUOTES(:foreign_key_names.TABLE_NAME[i]) || '" DROP CONSTRAINT "' || ESCAPE_DOUBLE_QUOTES(:foreign_key_names.CONSTRAINT_NAME[i]) || '"'; -END FOR; - -END; -$$ - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_column TABLE, COLUMN --- deletes the column and ensures that all indices and constraints are dropped first --- -CREATE OR REPLACE PROCEDURE usp_ebean_drop_column(IN table_name NVARCHAR(256), IN column_name NVARCHAR(256)) -AS -BEGIN -CALL usp_ebean_drop_foreign_keys(table_name, column_name); -EXEC 'ALTER TABLE "' || UPPER(ESCAPE_DOUBLE_QUOTES(table_name)) || '" DROP ("' || UPPER(ESCAPE_DOUBLE_QUOTES(column_name)) || '")'; -END; -$$ diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/hana/R__order_views_hana.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/hana/R__order_views_hana.sql deleted file mode 100644 index 85b1dce9f..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/hana/R__order_views_hana.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id; - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/hana/idx_hana.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/hana/idx_hana.migrations deleted file mode 100644 index 69da0b279..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/hana/idx_hana.migrations +++ /dev/null @@ -1,4 +0,0 @@ --745347271, I__create_procs.sql -1457017245, 1.0__initial.sql -1906063401, R__order_views_hana.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/1.0__initial.sql deleted file mode 100644 index aabebada9..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/1.0__initial.sql +++ /dev/null @@ -1,233 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity (start with 1) not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity (start with 1) not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity (start with 1) not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity (start with 1) not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity (start with 1) not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity (start with 1) not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity (start with 1) not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity (start with 1) not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity (start with 1) not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamp, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity (start with 1) not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity (start with 1) not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity (start with 1) not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity (start with 1) not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity (start with 1) not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity (start with 1) not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity (start with 1) not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity (start with 1) not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity (start with 1) not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity (start with 1) not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint generated by default as identity (start with 1) not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer generated by default as identity (start with 1) not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity (start with 1) not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/R__order_views_hsqldb.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/R__order_views_hsqldb.sql deleted file mode 100644 index 5f7ba1784..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/R__order_views_hsqldb.sql +++ /dev/null @@ -1,8 +0,0 @@ - - drop view order_agg_vw if exists ; - create view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id; - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations deleted file mode 100644 index a7d039572..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations +++ /dev/null @@ -1,3 +0,0 @@ --1869771532, 1.0__initial.sql -861001272, R__order_views_hsqldb.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql deleted file mode 100644 index dd7cae250..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql +++ /dev/null @@ -1,236 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer auto_increment not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer auto_increment not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer auto_increment not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date datetime(6), - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field tinyint(1) default 1 not null, - new_boolean_field2 tinyint(1) default 1 not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer auto_increment not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer auto_increment not null, - test_string bigint comment 'Column altered to long now', - constraint pk_migtest_e_history primary key (id) -) comment='We have history now'; - -create table migtest_e_history2 ( - id integer auto_increment not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer auto_increment not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer auto_increment not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer auto_increment not null, - test_number integer, - test_boolean tinyint(1) default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer auto_increment not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer auto_increment not null, - test_string varchar(255), - deleted tinyint(1) default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer auto_increment not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer auto_increment not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add system versioning; -alter table migtest_e_history2 add system versioning; -alter table migtest_e_history3 add system versioning; -alter table migtest_e_history4 add system versioning; -alter table migtest_e_history5 add system versioning; -alter table migtest_e_history6 add system versioning; --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/R__order_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations deleted file mode 100644 index 0c0f251de..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations +++ /dev/null @@ -1,4 +0,0 @@ -1835064798, I__create_procs.sql -399669760, 1.0__initial.sql -561281075, R__order_views.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/model/1.0__initial.model.xml b/ebean-test/src/main/resources/migrationtest/dbmigration/model/1.0__initial.model.xml deleted file mode 100644 index dccbd490a..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/model/1.0__initial.model.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update ${table} set ${column} = old_boolean - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/1.0__initial.sql deleted file mode 100644 index 4a3ad7249..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/1.0__initial.sql +++ /dev/null @@ -1,362 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer auto_increment not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer auto_increment not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer auto_increment not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date datetime(6), - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field tinyint(1) default 1 not null, - new_boolean_field2 tinyint(1) default 1 not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer auto_increment not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer auto_increment not null, - test_string bigint comment 'Column altered to long now', - constraint pk_migtest_e_history primary key (id) -) comment='We have history now'; - -create table migtest_e_history2 ( - id integer auto_increment not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer auto_increment not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer auto_increment not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer auto_increment not null, - test_number integer, - test_boolean tinyint(1) default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer auto_increment not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer auto_increment not null, - test_string varchar(255), - deleted tinyint(1) default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer auto_increment not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer auto_increment not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history add column sys_period_end datetime(6); -alter table migtest_e_history2 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history2 add column sys_period_end datetime(6); -alter table migtest_e_history3 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history3 add column sys_period_end datetime(6); -alter table migtest_e_history4 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history4 add column sys_period_end datetime(6); -alter table migtest_e_history5 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history5 add column sys_period_end datetime(6); -alter table migtest_e_history6 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history6 add column sys_period_end datetime(6); --- apply post alter -create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -lock tables migtest_e_history write; -delimiter $$ -create trigger migtest_e_history_history_upd before update on migtest_e_history for each row begin - insert into migtest_e_history_history (sys_period_start,sys_period_end,id, test_string) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history_history_del before delete on migtest_e_history for each row begin - insert into migtest_e_history_history (sys_period_start,sys_period_end,id, test_string) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string); -end$$ -unlock tables; - -create table migtest_e_history2_history( - id integer, - test_string varchar(255), - test_string2 varchar(255), - test_string3 varchar(255), - new_column varchar(20), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -lock tables migtest_e_history2 write; -delimiter $$ -create trigger migtest_e_history2_history_upd before update on migtest_e_history2 for each row begin - insert into migtest_e_history2_history (sys_period_start,sys_period_end,id, test_string, test_string3, new_column) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history2_history_del before delete on migtest_e_history2 for each row begin - insert into migtest_e_history2_history (sys_period_start,sys_period_end,id, test_string, test_string3, new_column) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); -end$$ -unlock tables; - -create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -lock tables migtest_e_history3 write; -delimiter $$ -create trigger migtest_e_history3_history_upd before update on migtest_e_history3 for each row begin - insert into migtest_e_history3_history (sys_period_start,sys_period_end,id) values (OLD.sys_period_start, now(6),OLD.id); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history3_history_del before delete on migtest_e_history3 for each row begin - insert into migtest_e_history3_history (sys_period_start,sys_period_end,id) values (OLD.sys_period_start, now(6),OLD.id); -end$$ -unlock tables; - -create table migtest_e_history4_history( - id integer, - test_number bigint, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -lock tables migtest_e_history4 write; -delimiter $$ -create trigger migtest_e_history4_history_upd before update on migtest_e_history4 for each row begin - insert into migtest_e_history4_history (sys_period_start,sys_period_end,id, test_number) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history4_history_del before delete on migtest_e_history4 for each row begin - insert into migtest_e_history4_history (sys_period_start,sys_period_end,id, test_number) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number); -end$$ -unlock tables; - -create table migtest_e_history5_history( - id integer, - test_number integer, - test_boolean tinyint(1), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -lock tables migtest_e_history5 write; -delimiter $$ -create trigger migtest_e_history5_history_upd before update on migtest_e_history5 for each row begin - insert into migtest_e_history5_history (sys_period_start,sys_period_end,id, test_number, test_boolean) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number, OLD.test_boolean); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history5_history_del before delete on migtest_e_history5 for each row begin - insert into migtest_e_history5_history (sys_period_start,sys_period_end,id, test_number, test_boolean) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number, OLD.test_boolean); -end$$ -unlock tables; - -create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -lock tables migtest_e_history6 write; -delimiter $$ -create trigger migtest_e_history6_history_upd before update on migtest_e_history6 for each row begin - insert into migtest_e_history6_history (sys_period_start,sys_period_end,id, test_number1, test_number2) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number1, OLD.test_number2); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history6_history_del before delete on migtest_e_history6 for each row begin - insert into migtest_e_history6_history (sys_period_start,sys_period_end,id, test_number1, test_number2) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number1, OLD.test_number2); -end$$ -unlock tables; - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/I__create_procs.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/I__create_procs.sql deleted file mode 100644 index d13ec2708..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/I__create_procs.sql +++ /dev/null @@ -1,48 +0,0 @@ --- Inital script to create stored procedures etc for mysql platform -DROP PROCEDURE IF EXISTS usp_ebean_drop_foreign_keys; - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_foreign_keys TABLE, COLUMN --- deletes all constraints and foreign keys referring to TABLE.COLUMN --- -CREATE PROCEDURE usp_ebean_drop_foreign_keys(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) -BEGIN -DECLARE done INT DEFAULT FALSE; -DECLARE c_fk_name CHAR(255); -DECLARE curs CURSOR FOR SELECT CONSTRAINT_NAME from information_schema.KEY_COLUMN_USAGE -WHERE TABLE_SCHEMA = DATABASE() and TABLE_NAME = p_table_name and COLUMN_NAME = p_column_name -AND REFERENCED_TABLE_NAME IS NOT NULL; -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN curs; - -read_loop: LOOP -FETCH curs INTO c_fk_name; -IF done THEN -LEAVE read_loop; -END IF; -SET @sql = CONCAT('ALTER TABLE ', p_table_name, ' DROP FOREIGN KEY ', c_fk_name); -PREPARE stmt FROM @sql; -EXECUTE stmt; -END LOOP; - -CLOSE curs; -END -$$ - -DROP PROCEDURE IF EXISTS usp_ebean_drop_column; - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_column TABLE, COLUMN --- deletes the column and ensures that all indices and constraints are dropped first --- -CREATE PROCEDURE usp_ebean_drop_column(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) -BEGIN -CALL usp_ebean_drop_foreign_keys(p_table_name, p_column_name); -SET @sql = CONCAT('ALTER TABLE ', p_table_name, ' DROP COLUMN ', p_column_name); -PREPARE stmt FROM @sql; -EXECUTE stmt; -END -$$ diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/R__order_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations deleted file mode 100644 index c896445e0..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations +++ /dev/null @@ -1,4 +0,0 @@ -1835064798, I__create_procs.sql -251257412, 1.0__initial.sql -561281075, R__order_views.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/1.0__initial.sql deleted file mode 100644 index 3a1f8d7ae..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/1.0__initial.sql +++ /dev/null @@ -1,362 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer auto_increment not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer auto_increment not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint auto_increment not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint auto_increment not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer auto_increment not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date datetime, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field tinyint(1) default 1 not null, - new_boolean_field2 tinyint(1) default 1 not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer auto_increment not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer auto_increment not null, - test_string bigint comment 'Column altered to long now', - constraint pk_migtest_e_history primary key (id) -) comment='We have history now'; - -create table migtest_e_history2 ( - id integer auto_increment not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer auto_increment not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer auto_increment not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer auto_increment not null, - test_number integer, - test_boolean tinyint(1) default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer auto_increment not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer auto_increment not null, - test_string varchar(255), - deleted tinyint(1) default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer auto_increment not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer auto_increment not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint auto_increment not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history add column sys_period_end datetime(6); -alter table migtest_e_history2 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history2 add column sys_period_end datetime(6); -alter table migtest_e_history3 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history3 add column sys_period_end datetime(6); -alter table migtest_e_history4 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history4 add column sys_period_end datetime(6); -alter table migtest_e_history5 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history5 add column sys_period_end datetime(6); -alter table migtest_e_history6 add column sys_period_start datetime(6) default now(6); -alter table migtest_e_history6 add column sys_period_end datetime(6); --- apply post alter -create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -lock tables migtest_e_history write; -delimiter $$ -create trigger migtest_e_history_history_upd before update on migtest_e_history for each row begin - insert into migtest_e_history_history (sys_period_start,sys_period_end,id, test_string) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history_history_del before delete on migtest_e_history for each row begin - insert into migtest_e_history_history (sys_period_start,sys_period_end,id, test_string) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string); -end$$ -unlock tables; - -create table migtest_e_history2_history( - id integer, - test_string varchar(255), - test_string2 varchar(255), - test_string3 varchar(255), - new_column varchar(20), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -lock tables migtest_e_history2 write; -delimiter $$ -create trigger migtest_e_history2_history_upd before update on migtest_e_history2 for each row begin - insert into migtest_e_history2_history (sys_period_start,sys_period_end,id, test_string, test_string3, new_column) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history2_history_del before delete on migtest_e_history2 for each row begin - insert into migtest_e_history2_history (sys_period_start,sys_period_end,id, test_string, test_string3, new_column) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); -end$$ -unlock tables; - -create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -lock tables migtest_e_history3 write; -delimiter $$ -create trigger migtest_e_history3_history_upd before update on migtest_e_history3 for each row begin - insert into migtest_e_history3_history (sys_period_start,sys_period_end,id) values (OLD.sys_period_start, now(6),OLD.id); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history3_history_del before delete on migtest_e_history3 for each row begin - insert into migtest_e_history3_history (sys_period_start,sys_period_end,id) values (OLD.sys_period_start, now(6),OLD.id); -end$$ -unlock tables; - -create table migtest_e_history4_history( - id integer, - test_number bigint, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -lock tables migtest_e_history4 write; -delimiter $$ -create trigger migtest_e_history4_history_upd before update on migtest_e_history4 for each row begin - insert into migtest_e_history4_history (sys_period_start,sys_period_end,id, test_number) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history4_history_del before delete on migtest_e_history4 for each row begin - insert into migtest_e_history4_history (sys_period_start,sys_period_end,id, test_number) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number); -end$$ -unlock tables; - -create table migtest_e_history5_history( - id integer, - test_number integer, - test_boolean tinyint(1), - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -lock tables migtest_e_history5 write; -delimiter $$ -create trigger migtest_e_history5_history_upd before update on migtest_e_history5 for each row begin - insert into migtest_e_history5_history (sys_period_start,sys_period_end,id, test_number, test_boolean) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number, OLD.test_boolean); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history5_history_del before delete on migtest_e_history5 for each row begin - insert into migtest_e_history5_history (sys_period_start,sys_period_end,id, test_number, test_boolean) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number, OLD.test_boolean); -end$$ -unlock tables; - -create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period_start datetime(6), - sys_period_end datetime(6) -); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -lock tables migtest_e_history6 write; -delimiter $$ -create trigger migtest_e_history6_history_upd before update on migtest_e_history6 for each row begin - insert into migtest_e_history6_history (sys_period_start,sys_period_end,id, test_number1, test_number2) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number1, OLD.test_number2); - set NEW.sys_period_start = now(6); -end$$ -delimiter $$ -create trigger migtest_e_history6_history_del before delete on migtest_e_history6 for each row begin - insert into migtest_e_history6_history (sys_period_start,sys_period_end,id, test_number1, test_number2) values (OLD.sys_period_start, now(6),OLD.id, OLD.test_number1, OLD.test_number2); -end$$ -unlock tables; - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/I__create_procs.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/I__create_procs.sql deleted file mode 100644 index d13ec2708..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/I__create_procs.sql +++ /dev/null @@ -1,48 +0,0 @@ --- Inital script to create stored procedures etc for mysql platform -DROP PROCEDURE IF EXISTS usp_ebean_drop_foreign_keys; - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_foreign_keys TABLE, COLUMN --- deletes all constraints and foreign keys referring to TABLE.COLUMN --- -CREATE PROCEDURE usp_ebean_drop_foreign_keys(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) -BEGIN -DECLARE done INT DEFAULT FALSE; -DECLARE c_fk_name CHAR(255); -DECLARE curs CURSOR FOR SELECT CONSTRAINT_NAME from information_schema.KEY_COLUMN_USAGE -WHERE TABLE_SCHEMA = DATABASE() and TABLE_NAME = p_table_name and COLUMN_NAME = p_column_name -AND REFERENCED_TABLE_NAME IS NOT NULL; -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN curs; - -read_loop: LOOP -FETCH curs INTO c_fk_name; -IF done THEN -LEAVE read_loop; -END IF; -SET @sql = CONCAT('ALTER TABLE ', p_table_name, ' DROP FOREIGN KEY ', c_fk_name); -PREPARE stmt FROM @sql; -EXECUTE stmt; -END LOOP; - -CLOSE curs; -END -$$ - -DROP PROCEDURE IF EXISTS usp_ebean_drop_column; - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_column TABLE, COLUMN --- deletes the column and ensures that all indices and constraints are dropped first --- -CREATE PROCEDURE usp_ebean_drop_column(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) -BEGIN -CALL usp_ebean_drop_foreign_keys(p_table_name, p_column_name); -SET @sql = CONCAT('ALTER TABLE ', p_table_name, ' DROP COLUMN ', p_column_name); -PREPARE stmt FROM @sql; -EXECUTE stmt; -END -$$ diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/R__order_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations deleted file mode 100644 index 7dc5345d5..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations +++ /dev/null @@ -1,4 +0,0 @@ -1835064798, I__create_procs.sql -1129732015, 1.0__initial.sql -561281075, R__order_views.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/1.0__initial.sql deleted file mode 100644 index 5d8d0b76e..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/1.0__initial.sql +++ /dev/null @@ -1,233 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id number(10) generated by default as identity not null, - assoc_one varchar2(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id number(10) generated by default as identity not null, - something varchar2(255), - one_key number(10), - two_key varchar2(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key number(10) not null, - two_key varchar2(127) not null, - name varchar2(255), - assoc_id number(10), - version number(10) not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id number(19) generated by default as identity not null, - one_id number(19), - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id number(19) generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id number(19) generated by default as identity not null, - one_id number(19), - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id number(19) generated by default as identity not null, - one_id number(19), - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id number(19) generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id number(19) generated by default as identity not null, - one_id number(19), - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id number(10) generated by default as identity not null, - status varchar2(1) default 'A' not null, - status2 varchar2(127), - name varchar2(127), - description varchar2(127), - some_date timestamp, - new_string_field varchar2(255) default 'foo''bar' not null, - new_boolean_field number(1) default 1 not null, - new_boolean_field2 number(1) default 1 not null, - indextest1 varchar2(127), - indextest2 varchar2(127), - indextest3 varchar2(127), - indextest4 varchar2(127), - indextest5 varchar2(127), - indextest6 varchar2(127), - progress number(10) default 0 not null, - new_integer number(10) default 42 not null, - user_id number(10), - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id number(10) generated by default as identity not null, - test_status varchar2(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id number(10) generated by default as identity not null, - test_string number(19), - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id number(10) generated by default as identity not null, - test_string varchar2(255) default 'unknown' not null, - test_string2 varchar2(255), - test_string3 varchar2(255) default 'unknown' not null, - new_column varchar2(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id number(10) generated by default as identity not null, - test_string varchar2(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id number(10) generated by default as identity not null, - test_number number(19), - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id number(10) generated by default as identity not null, - test_number number(10), - test_boolean number(1) default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id number(10) generated by default as identity not null, - test_number1 number(10) default 42 not null, - test_number2 number(10), - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id number(10) generated by default as identity not null, - test_string varchar2(255), - deleted number(1) default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id number(10) generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id number(10) generated by default as identity not null, - name varchar2(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id number(10) not null, - migtest_mtm_m_id number(19) not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id number(19) generated by default as identity not null, - name varchar2(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id number(19) not null, - migtest_mtm_c_id number(10) not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id number(19) not null, - value varchar2(255) not null -); - -create table migtest_oto_child ( - id number(10) generated by default as identity not null, - name varchar2(255), - master_id number(19), - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id number(19) generated by default as identity not null, - name varchar2(255), - constraint pk_migtest_oto_master primary key (id) -); - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key); - -create index ix_mgtst_cky_prnt_ssc_d on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_mgtst_cky_prnt_ssc_d foreign key (assoc_id) references migtest_ckey_assoc (id); - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id); - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id); - -create index ix_mgtst_fk_nn_v_jn_n_d on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_mgtst_fk_nn_v_jn_n_d foreign key (one_id) references migtest_fk_one (id); - -create index ix_migtest_fk_set_null_one_id on 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); - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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); - -create index ix_mgtst_mtm_c_mgtst_mt_3ug4ou on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_mgtst_mtm_c_mgtst_mt_93awgk foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -create index ix_mgtst_mtm_m_mgtst_mt_b7nbcu on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_mgtst_mtm_m_mgtst_mt_ggi34k foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -create index ix_mgtst_mtm_m_mgtst_mt_b7nbck on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_mgtst_mtm_m_mgtst_mt_ggi34a foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); - -create index ix_mgtst_mtm_m_phn_nmbr_do9ma3 on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_mgtst_mtm_m_phn_nmbr_s8neid foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id); - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/R__oracle_only_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/R__oracle_only_views.sql deleted file mode 100644 index 1140e5361..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/R__oracle_only_views.sql +++ /dev/null @@ -1,4 +0,0 @@ - - -- oracle only script - select * from dual; - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/R__order_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations deleted file mode 100644 index 75b3861a6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations +++ /dev/null @@ -1,4 +0,0 @@ -1634222133, 1.0__initial.sql -1357801733, R__oracle_only_views.sql -561281075, R__order_views.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/1.0__initial.sql deleted file mode 100644 index b22dc2127..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/1.0__initial.sql +++ /dev/null @@ -1,392 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamptz, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer generated by default as identity not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history2 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history3 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history4 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history5 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history6 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); --- apply post alter -create table migtest_e_history_history(like migtest_e_history); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -create or replace function migtest_e_history_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history_history (sys_period,id, test_string) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history_history (sys_period,id, test_string) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history_history_upd - before update or delete on migtest_e_history - for each row execute procedure migtest_e_history_history_version(); - - -create table migtest_e_history2_history(like migtest_e_history2); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -create or replace function migtest_e_history2_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history2_history (sys_period,id, test_string, test_string3, new_column) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history2_history (sys_period,id, test_string, test_string3, new_column) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history2_history_upd - before update or delete on migtest_e_history2 - for each row execute procedure migtest_e_history2_history_version(); - - -create table migtest_e_history3_history(like migtest_e_history3); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -create or replace function migtest_e_history3_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history3_history (sys_period,id) values (tstzrange(lowerTs,upperTs), OLD.id); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history3_history (sys_period,id) values (tstzrange(lowerTs,upperTs), OLD.id); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history3_history_upd - before update or delete on migtest_e_history3 - for each row execute procedure migtest_e_history3_history_version(); - - -create table migtest_e_history4_history(like migtest_e_history4); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -create or replace function migtest_e_history4_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history4_history (sys_period,id, test_number) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history4_history (sys_period,id, test_number) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history4_history_upd - before update or delete on migtest_e_history4 - for each row execute procedure migtest_e_history4_history_version(); - - -create table migtest_e_history5_history(like migtest_e_history5); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -create or replace function migtest_e_history5_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history5_history (sys_period,id, test_number, test_boolean) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number, OLD.test_boolean); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history5_history (sys_period,id, test_number, test_boolean) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number, OLD.test_boolean); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history5_history_upd - before update or delete on migtest_e_history5 - for each row execute procedure migtest_e_history5_history_version(); - - -create table migtest_e_history6_history(like migtest_e_history6); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -create or replace function migtest_e_history6_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history6_history (sys_period,id, test_number1, test_number2) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number1, OLD.test_number2); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history6_history (sys_period,id, test_number1, test_number2) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number1, OLD.test_number2); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history6_history_upd - before update or delete on migtest_e_history6 - for each row execute procedure migtest_e_history6_history_version(); - - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index if not exists ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index if not exists ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); -create index if not exists ix_migtest_oto_child_name on migtest_oto_child (name); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__multi_comments.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__multi_comments.sql deleted file mode 100644 index 0ede0c9eb..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__multi_comments.sql +++ /dev/null @@ -1,3 +0,0 @@ - - -- h2 and postgres script - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__order_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__pg_indexes.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__pg_indexes.sql deleted file mode 100644 index fa0bab998..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/R__pg_indexes.sql +++ /dev/null @@ -1,4 +0,0 @@ - - -- postgres specific indexes - create index ix_ebasic_jmjb_gin2 on ebasic_json_map_json_b using gin(content jsonb_path_ops); - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations deleted file mode 100644 index 5e798e30f..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations +++ /dev/null @@ -1,5 +0,0 @@ -2107694286, 1.0__initial.sql -783227075, R__multi_comments.sql -561281075, R__order_views.sql -283077354, R__pg_indexes.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/1.0__initial.sql deleted file mode 100644 index 6ff6d8ceb..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/1.0__initial.sql +++ /dev/null @@ -1,206 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id), - foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key), - foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict -); - -create table migtest_fk_cascade ( - id integer not null, - one_id integer, - constraint pk_migtest_fk_cascade primary key (id), - foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict -); - -create table migtest_fk_cascade_one ( - id integer not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id integer not null, - one_id integer, - constraint pk_migtest_fk_none primary key (id), - foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict -); - -create table migtest_fk_none_via_join ( - id integer not null, - one_id integer, - constraint pk_migtest_fk_none_via_join primary key (id), - foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict -); - -create table migtest_fk_one ( - id integer not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id integer not null, - one_id integer, - constraint pk_migtest_fk_set_null primary key (id), - foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict -); - -create table migtest_e_basic ( - id integer not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamp, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field int default 1 not null, - new_boolean_field2 int default 1 not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id), - foreign key (user_id) references migtest_e_user (id) on delete restrict on update restrict -); - -create table migtest_e_enum ( - id integer not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer not null, - test_string integer, - constraint pk_migtest_e_history primary key (id) -); - -create table migtest_e_history2 ( - id integer not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer not null, - test_number integer, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer not null, - test_number integer, - test_boolean int default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer not null, - test_string varchar(255), - deleted int default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id integer not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id), - foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict, - foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict -); - -create table migtest_mtm_m ( - id integer not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id integer not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id), - foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict, - foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id integer not null, - value varchar(255) not null, - foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict -); - -create table migtest_oto_child ( - id integer not null, - name varchar(255), - master_id integer, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id), - foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict -); - -create table migtest_oto_master ( - id integer not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- foreign keys and indices -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/R__order_views_sqlite.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/R__order_views_sqlite.sql deleted file mode 100644 index 9572b5c26..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/R__order_views_sqlite.sql +++ /dev/null @@ -1,8 +0,0 @@ - - drop view if exists order_agg_vw; - create view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id; - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations deleted file mode 100644 index 6daa8885c..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations +++ /dev/null @@ -1,3 +0,0 @@ -6725356, 1.0__initial.sql -2034589659, R__order_views_sqlite.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/1.0__initial.sql deleted file mode 100644 index d4934452b..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/1.0__initial.sql +++ /dev/null @@ -1,284 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer not null, - assoc_one nvarchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); -create sequence migtest_ckey_assoc_seq as bigint start with 1; - -create table migtest_ckey_detail ( - id integer not null, - something nvarchar(255), - one_key integer, - two_key nvarchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); -create sequence migtest_ckey_detail_seq as bigint start with 1; - -create table migtest_ckey_parent ( - one_key integer not null, - two_key nvarchar(127) not null, - name nvarchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id numeric(19) not null, - one_id numeric(19), - constraint pk_migtest_fk_cascade primary key (id) -); -create sequence migtest_fk_cascade_seq as bigint start with 1; - -create table migtest_fk_cascade_one ( - id numeric(19) not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); -create sequence migtest_fk_cascade_one_seq as bigint start with 1; - -create table migtest_fk_none ( - id numeric(19) not null, - one_id numeric(19), - constraint pk_migtest_fk_none primary key (id) -); -create sequence migtest_fk_none_seq as bigint start with 1; - -create table migtest_fk_none_via_join ( - id numeric(19) not null, - one_id numeric(19), - constraint pk_migtest_fk_none_via_join primary key (id) -); -create sequence migtest_fk_none_via_join_seq as bigint start with 1; - -create table migtest_fk_one ( - id numeric(19) not null, - constraint pk_migtest_fk_one primary key (id) -); -create sequence migtest_fk_one_seq as bigint start with 1; - -create table migtest_fk_set_null ( - id numeric(19) not null, - one_id numeric(19), - constraint pk_migtest_fk_set_null primary key (id) -); -create sequence migtest_fk_set_null_seq as bigint start with 1; - -create table migtest_e_basic ( - id integer not null, - status nvarchar(1) default 'A' not null, - status2 nvarchar(127), - name nvarchar(127), - description nvarchar(127), - some_date datetime2, - new_string_field nvarchar(255) default 'foo''bar' not null, - new_boolean_field bit default 1 not null, - new_boolean_field2 bit default 1 not null, - indextest1 nvarchar(127), - indextest2 nvarchar(127), - indextest3 nvarchar(127), - indextest4 nvarchar(127), - indextest5 nvarchar(127), - indextest6 nvarchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint pk_migtest_e_basic primary key (id) -); -create sequence migtest_e_basic_seq as bigint start with 1; - -create table migtest_e_enum ( - id integer not null, - test_status nvarchar(1), - constraint pk_migtest_e_enum primary key (id) -); -create sequence migtest_e_enum_seq as bigint start with 1; - -create table migtest_e_history ( - id integer not null, - test_string numeric(19), - constraint pk_migtest_e_history primary key (id) -); -create sequence migtest_e_history_seq as bigint start with 1; - -create table migtest_e_history2 ( - id integer not null, - test_string nvarchar(255) default 'unknown' not null, - test_string2 nvarchar(255), - test_string3 nvarchar(255) default 'unknown' not null, - new_column nvarchar(20), - constraint pk_migtest_e_history2 primary key (id) -); -create sequence migtest_e_history2_seq as bigint start with 1; - -create table migtest_e_history3 ( - id integer not null, - test_string nvarchar(255), - constraint pk_migtest_e_history3 primary key (id) -); -create sequence migtest_e_history3_seq as bigint start with 1; - -create table migtest_e_history4 ( - id integer not null, - test_number numeric(19), - constraint pk_migtest_e_history4 primary key (id) -); -create sequence migtest_e_history4_seq as bigint start with 1; - -create table migtest_e_history5 ( - id integer not null, - test_number integer, - test_boolean bit default 0 not null, - constraint pk_migtest_e_history5 primary key (id) -); -create sequence migtest_e_history5_seq as bigint start with 1; - -create table migtest_e_history6 ( - id integer not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); -create sequence migtest_e_history6_seq as bigint start with 1; - -create table migtest_e_softdelete ( - id integer not null, - test_string nvarchar(255), - deleted bit default 0 not null, - constraint pk_migtest_e_softdelete primary key (id) -); -create sequence migtest_e_softdelete_seq as bigint start with 1; - -create table migtest_e_user ( - id integer not null, - constraint pk_migtest_e_user primary key (id) -); -create sequence migtest_e_user_seq as bigint start with 1; - -create table migtest_mtm_c ( - id integer not null, - name nvarchar(255), - constraint pk_migtest_mtm_c primary key (id) -); -create sequence migtest_mtm_c_seq as bigint start with 1; - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id numeric(19) not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id numeric(19) not null, - name nvarchar(255), - constraint pk_migtest_mtm_m primary key (id) -); -create sequence migtest_mtm_m_seq as bigint start with 1; - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id numeric(19) not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id numeric(19) not null, - value nvarchar(255) not null -); - -create table migtest_oto_child ( - id integer not null, - name nvarchar(255), - master_id numeric(19), - constraint pk_migtest_oto_child primary key (id) -); -create sequence migtest_oto_child_seq as bigint start with 1; - -create table migtest_oto_master ( - id numeric(19) not null, - name nvarchar(255), - constraint pk_migtest_oto_master primary key (id) -); -create sequence migtest_oto_master_seq as bigint start with 1; - --- apply post alter -create unique nonclustered index uq_migtest_e_basic_description on migtest_e_basic(description) where description is not null; -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; -alter table migtest_e_history - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history set (system_versioning = on (history_table=dbo.migtest_e_history_history)); -alter table migtest_e_history2 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history2 set (system_versioning = on (history_table=dbo.migtest_e_history2_history)); -alter table migtest_e_history3 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history3 set (system_versioning = on (history_table=dbo.migtest_e_history3_history)); -alter table migtest_e_history4 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history4 set (system_versioning = on (history_table=dbo.migtest_e_history4_history)); -alter table migtest_e_history5 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history5 set (system_versioning = on (history_table=dbo.migtest_e_history5_history)); -alter table migtest_e_history6 - add sys_periodFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL DEFAULT SYSUTCDATETIME(), - sys_periodTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL DEFAULT '9999-12-31T23:59:59.9999999', -period for system_time (sys_periodFrom, sys_periodTo); -alter table migtest_e_history6 set (system_versioning = on (history_table=dbo.migtest_e_history6_history)); -create unique nonclustered index uq_migtest_oto_child_master_id on migtest_oto_child(master_id) where master_id is not null; --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key); - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id); - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id); - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id); - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id); - -create index ix_migtest_fk_set_null_one_id on 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); - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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); - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id); - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id); - -create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/I__create_procs.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/I__create_procs.sql deleted file mode 100644 index 6f916bcc9..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/I__create_procs.sql +++ /dev/null @@ -1,110 +0,0 @@ --- Initial script to create stored procedures etc for sqlserver platform - --- create table-value-parameters -if not exists (select name from sys.types where name = 'ebean_bigint_tvp') create type ebean_bigint_tvp as table (c1 bigint) -GO -if not exists (select name from sys.types where name = 'ebean_float_tvp') create type ebean_float_tvp as table (c1 float) -GO -if not exists (select name from sys.types where name = 'ebean_bit_tvp') create type ebean_bit_tvp as table (c1 bit) -GO -if not exists (select name from sys.types where name = 'ebean_date_tvp') create type ebean_date_tvp as table (c1 date) -GO -if not exists (select name from sys.types where name = 'ebean_time_tvp') create type ebean_time_tvp as table (c1 time) -GO -if not exists (select name from sys.types where name = 'ebean_uniqueidentifier_tvp') create type ebean_uniqueidentifier_tvp as table (c1 uniqueidentifier) -GO -if not exists (select name from sys.types where name = 'ebean_nvarchar_tvp') create type ebean_nvarchar_tvp as table (c1 nvarchar(max)) -GO - --- --- PROCEDURE: usp_ebean_drop_indices TABLE, COLUMN --- deletes all indices referring to TABLE.COLUMN --- -CREATE OR ALTER PROCEDURE usp_ebean_drop_indices @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON -declare @sql nvarchar(1000) -declare @indexName nvarchar(255) -BEGIN - DECLARE index_cursor CURSOR FOR SELECT i.name from sys.indexes i - join sys.index_columns ic on ic.object_id = i.object_id and ic.index_id = i.index_id - join sys.columns c on c.object_id = ic.object_id and c.column_id = ic.column_id - where i.object_id = OBJECT_ID(@tableName) AND c.name = @columnName; - OPEN index_cursor - FETCH NEXT FROM index_cursor INTO @indexName - WHILE @@FETCH_STATUS = 0 - BEGIN - set @sql = 'drop index ' + @indexName + ' on ' + @tableName; - EXECUTE(@sql); - - FETCH NEXT FROM index_cursor INTO @indexName - END; - CLOSE index_cursor; - DEALLOCATE index_cursor; -END -GO - --- --- PROCEDURE: usp_ebean_drop_default_constraint TABLE, COLUMN --- deletes the default constraint, which has a random name --- -CREATE OR ALTER PROCEDURE usp_ebean_drop_default_constraint @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON -declare @tmp nvarchar(1000) -BEGIN - select @tmp = t1.name from sys.default_constraints t1 - join sys.columns t2 on t1.object_id = t2.default_object_id - where t1.parent_object_id = OBJECT_ID(@tableName) and t2.name = @columnName; - - if @tmp is not null EXEC('alter table ' + @tableName +' drop constraint ' + @tmp); -END -GO - --- --- PROCEDURE: usp_ebean_drop_constraints TABLE, COLUMN --- deletes constraints and foreign keys refering to TABLE.COLUMN --- -CREATE OR ALTER PROCEDURE usp_ebean_drop_constraints @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON -declare @sql nvarchar(1000) -declare @constraintName nvarchar(255) -BEGIN - DECLARE name_cursor CURSOR FOR - SELECT cc.name from sys.check_constraints cc - join sys.columns c on c.object_id = cc.parent_object_id and c.column_id = cc.parent_column_id - where parent_object_id = OBJECT_ID(@tableName) AND c.name = @columnName - UNION SELECT fk.name from sys.foreign_keys fk - join sys.foreign_key_columns fkc on fkc.constraint_object_id = fk.object_id - and fkc.parent_object_id = fk.parent_object_id - join sys.columns c on c.object_id = fkc.parent_object_id and c.column_id = fkc.parent_column_id - where fkc.parent_object_id = OBJECT_ID(@tableName) AND c.name = @columnName; - - OPEN name_cursor - FETCH NEXT FROM name_cursor INTO @constraintName - WHILE @@FETCH_STATUS = 0 - BEGIN - set @sql = 'alter table ' + @tableName + ' drop constraint ' + @constraintName; - EXECUTE(@sql); - - FETCH NEXT FROM name_cursor INTO @constraintName - END; - CLOSE name_cursor; - DEALLOCATE name_cursor; -END -GO - --- --- PROCEDURE: usp_ebean_drop_column TABLE, COLUMN --- deletes the column annd ensures that all indices and constraints are dropped first --- -CREATE OR ALTER PROCEDURE usp_ebean_drop_column @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON -declare @sql nvarchar(1000) -BEGIN - EXEC usp_ebean_drop_indices @tableName, @columnName; - EXEC usp_ebean_drop_default_constraint @tableName, @columnName; - EXEC usp_ebean_drop_constraints @tableName, @columnName; - - set @sql = 'alter table ' + @tableName + ' drop column ' + @columnName; - EXECUTE(@sql); -END -GO diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/R__order_views_mssql.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/R__order_views_mssql.sql deleted file mode 100644 index 3b90ebb2d..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/R__order_views_mssql.sql +++ /dev/null @@ -1,10 +0,0 @@ - - IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'order_agg_vw') - DROP VIEW order_agg_vw; - - create view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id; - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations deleted file mode 100644 index 49c37e5d2..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations +++ /dev/null @@ -1,4 +0,0 @@ --2122378240, I__create_procs.sql -1625315960, 1.0__initial.sql -1607822082, R__order_views_mssql.sql - diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql deleted file mode 100644 index bef57d682..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql +++ /dev/null @@ -1,420 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_ckey_assoc ( - id integer generated by default as identity not null, - assoc_one varchar(255), - constraint pk_migtest_ckey_assoc primary key (id) -); - -create table migtest_ckey_detail ( - id integer generated by default as identity not null, - something varchar(255), - one_key integer, - two_key varchar(127), - constraint pk_migtest_ckey_detail primary key (id) -); - -create table migtest_ckey_parent ( - one_key integer not null, - two_key varchar(127) not null, - name varchar(255), - assoc_id integer, - version integer not null, - constraint pk_migtest_ckey_parent primary key (one_key,two_key) -); - -create table migtest_fk_cascade ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_cascade primary key (id) -); - -create table migtest_fk_cascade_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_cascade_one primary key (id) -); - -create table migtest_fk_none ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none primary key (id) -); - -create table migtest_fk_none_via_join ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_none_via_join primary key (id) -); - -create table migtest_fk_one ( - id bigint generated by default as identity not null, - constraint pk_migtest_fk_one primary key (id) -); - -create table migtest_fk_set_null ( - id bigint generated by default as identity not null, - one_id bigint, - constraint pk_migtest_fk_set_null primary key (id) -); - -create table migtest_e_basic ( - id integer generated by default as identity not null, - status varchar(1) default 'A' not null, - status2 varchar(127), - name varchar(127), - description varchar(127), - some_date timestamptz, - new_string_field varchar(255) default 'foo''bar' not null, - new_boolean_field boolean default true not null, - new_boolean_field2 boolean default true not null, - indextest1 varchar(127), - indextest2 varchar(127), - indextest3 varchar(127), - indextest4 varchar(127), - indextest5 varchar(127), - indextest6 varchar(127), - progress integer default 0 not null, - new_integer integer default 42 not null, - user_id integer, - constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?')), - constraint ck_migtest_e_basic_progress check ( progress in (0,1,2)), - constraint uq_migtest_e_basic_description unique (description), - constraint uq_migtest_e_basic_status_indextest1 unique (status,indextest1), - constraint uq_migtest_e_basic_name unique (name), - constraint uq_migtest_e_basic_indextest4 unique (indextest4), - constraint uq_migtest_e_basic_indextest5 unique (indextest5), - constraint pk_migtest_e_basic primary key (id) -); - -create table migtest_e_enum ( - id integer generated by default as identity not null, - test_status varchar(1), - constraint pk_migtest_e_enum primary key (id) -); - -create table migtest_e_history ( - id integer generated by default as identity not null, - test_string bigint, - constraint pk_migtest_e_history primary key (id) -); -comment on table migtest_e_history is 'We have history now'; -comment on column migtest_e_history.test_string is 'Column altered to long now'; - -create table migtest_e_history2 ( - id integer generated by default as identity not null, - test_string varchar(255) default 'unknown' not null, - test_string2 varchar(255), - test_string3 varchar(255) default 'unknown' not null, - new_column varchar(20), - constraint pk_migtest_e_history2 primary key (id) -); - -create table migtest_e_history3 ( - id integer generated by default as identity not null, - test_string varchar(255), - constraint pk_migtest_e_history3 primary key (id) -); - -create table migtest_e_history4 ( - id integer generated by default as identity not null, - test_number bigint, - constraint pk_migtest_e_history4 primary key (id) -); - -create table migtest_e_history5 ( - id integer generated by default as identity not null, - test_number integer, - test_boolean boolean default false not null, - constraint pk_migtest_e_history5 primary key (id) -); - -create table migtest_e_history6 ( - id integer generated by default as identity not null, - test_number1 integer default 42 not null, - test_number2 integer, - constraint pk_migtest_e_history6 primary key (id) -); - -create table migtest_e_softdelete ( - id integer generated by default as identity not null, - test_string varchar(255), - deleted boolean default false not null, - constraint pk_migtest_e_softdelete primary key (id) -); - -create table migtest_e_user ( - id integer generated by default as identity not null, - constraint pk_migtest_e_user primary key (id) -); - -create table migtest_mtm_c ( - id integer generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_c primary key (id) -); - -create table migtest_mtm_c_migtest_mtm_m ( - migtest_mtm_c_id integer not null, - migtest_mtm_m_id bigint not null, - constraint pk_migtest_mtm_c_migtest_mtm_m primary key (migtest_mtm_c_id,migtest_mtm_m_id) -); - -create table migtest_mtm_m ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_mtm_m primary key (id) -); - -create table migtest_mtm_m_migtest_mtm_c ( - migtest_mtm_m_id bigint not null, - migtest_mtm_c_id integer not null, - constraint pk_migtest_mtm_m_migtest_mtm_c primary key (migtest_mtm_m_id,migtest_mtm_c_id) -); - -create table migtest_mtm_m_phone_numbers ( - migtest_mtm_m_id bigint not null, - value varchar(255) not null -); - -create table migtest_oto_child ( - id integer generated by default as identity not null, - name varchar(255), - master_id bigint, - constraint uq_migtest_oto_child_master_id unique (master_id), - constraint pk_migtest_oto_child primary key (id) -); - -create table migtest_oto_master ( - id bigint generated by default as identity not null, - name varchar(255), - constraint pk_migtest_oto_master primary key (id) -); - --- apply alter tables -alter table migtest_e_history add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history2 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history3 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history4 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history5 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); -alter table migtest_e_history6 add column sys_period tstzrange not null default tstzrange(current_timestamp, null); --- apply post alter -create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period tstzrange -); -create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; -create or replace function migtest_e_history_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history_history (sys_period,id, test_string) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history_history (sys_period,id, test_string) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history_history_upd - before update or delete on migtest_e_history - for each row execute procedure migtest_e_history_history_version(); - - -create table migtest_e_history2_history( - id integer, - test_string varchar(255), - test_string2 varchar(255), - test_string3 varchar(255), - new_column varchar(20), - sys_period tstzrange -); -create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -create or replace function migtest_e_history2_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history2_history (sys_period,id, test_string, test_string3, new_column) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history2_history (sys_period,id, test_string, test_string3, new_column) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_string, OLD.test_string3, OLD.new_column); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history2_history_upd - before update or delete on migtest_e_history2 - for each row execute procedure migtest_e_history2_history_version(); - - -create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period tstzrange -); -create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -create or replace function migtest_e_history3_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history3_history (sys_period,id) values (tstzrange(lowerTs,upperTs), OLD.id); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history3_history (sys_period,id) values (tstzrange(lowerTs,upperTs), OLD.id); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history3_history_upd - before update or delete on migtest_e_history3 - for each row execute procedure migtest_e_history3_history_version(); - - -create table migtest_e_history4_history( - id integer, - test_number bigint, - sys_period tstzrange -); -create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -create or replace function migtest_e_history4_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history4_history (sys_period,id, test_number) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history4_history (sys_period,id, test_number) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history4_history_upd - before update or delete on migtest_e_history4 - for each row execute procedure migtest_e_history4_history_version(); - - -create table migtest_e_history5_history( - id integer, - test_number integer, - test_boolean boolean, - sys_period tstzrange -); -create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -create or replace function migtest_e_history5_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history5_history (sys_period,id, test_number, test_boolean) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number, OLD.test_boolean); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history5_history (sys_period,id, test_number, test_boolean) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number, OLD.test_boolean); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history5_history_upd - before update or delete on migtest_e_history5 - for each row execute procedure migtest_e_history5_history_version(); - - -create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period tstzrange -); -create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; -create or replace function migtest_e_history6_history_version() returns trigger as $$ -declare - lowerTs timestamptz; - upperTs timestamptz; -begin - lowerTs = lower(OLD.sys_period); - upperTs = greatest(lowerTs + '1 microsecond',current_timestamp); - if (TG_OP = 'UPDATE') then - insert into migtest_e_history6_history (sys_period,id, test_number1, test_number2) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number1, OLD.test_number2); - NEW.sys_period = tstzrange(upperTs,null); - return new; - elsif (TG_OP = 'DELETE') then - insert into migtest_e_history6_history (sys_period,id, test_number1, test_number2) values (tstzrange(lowerTs,upperTs), OLD.id, OLD.test_number1, OLD.test_number2); - return old; - end if; -end; -$$ LANGUAGE plpgsql; - -create trigger migtest_e_history6_history_upd - before update or delete on migtest_e_history6 - for each row execute procedure migtest_e_history6_history_version(); - - --- foreign keys and indices -create index ix_migtest_ckey_detail_parent on migtest_ckey_detail (one_key,two_key); -alter table migtest_ckey_detail add constraint fk_migtest_ckey_detail_parent foreign key (one_key,two_key) references migtest_ckey_parent (one_key,two_key) on delete restrict on update restrict; - -create index ix_migtest_ckey_parent_assoc_id on migtest_ckey_parent (assoc_id); -alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id foreign key (assoc_id) references migtest_ckey_assoc (id) on delete restrict on update restrict; - -create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id); -alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_one_id on migtest_fk_none (one_id); -alter table migtest_fk_none add constraint fk_migtest_fk_none_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_none_via_join_one_id on migtest_fk_none_via_join (one_id); -alter table migtest_fk_none_via_join add constraint fk_migtest_fk_none_via_join_one_id foreign key (one_id) references migtest_fk_one (id) on delete restrict on update restrict; - -create index ix_migtest_fk_set_null_one_id on 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; - -create index ix_migtest_e_basic_user_id on migtest_e_basic (user_id); -alter table migtest_e_basic add constraint fk_migtest_e_basic_user_id foreign key (user_id) references migtest_e_user (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; - -create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m on migtest_mtm_c_migtest_mtm_m (migtest_mtm_m_id); -alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m on migtest_mtm_m_migtest_mtm_c (migtest_mtm_m_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c on migtest_mtm_m_migtest_mtm_c (migtest_mtm_c_id); -alter table migtest_mtm_m_migtest_mtm_c add constraint fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; - -create index ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id on migtest_mtm_m_phone_numbers (migtest_mtm_m_id); -alter table migtest_mtm_m_phone_numbers add constraint fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id foreign key (migtest_mtm_m_id) references migtest_mtm_m (id) on delete restrict on update restrict; - -alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; - -create index if not exists ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3); -create index if not exists ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6); diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/R__order_views.sql b/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations b/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations deleted file mode 100644 index da29b8ea8..000000000 --- a/ebean-test/src/main/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations +++ /dev/null @@ -1,3 +0,0 @@ -964249682, 1.0__initial.sql -561281075, R__order_views.sql - diff --git a/ebean-test/src/test/resources/dbmigration/migrationtest-history/1.0__initial.sql b/ebean-test/src/test/resources/dbmigration/migrationtest-history/1.0__initial.sql deleted file mode 100644 index c2e2019a7..000000000 --- a/ebean-test/src/test/resources/dbmigration/migrationtest-history/1.0__initial.sql +++ /dev/null @@ -1,17 +0,0 @@ --- Migrationscripts for ebean unittest DbMigrationDropHistoryTest --- apply changes -create table migtest_e_history7 ( - id integer generated by default as identity not null, - constraint pk_migtest_e_history7 primary key (id) -); - -alter table migtest_e_history7 add column sys_period_start timestamp default now(); -alter table migtest_e_history7 add column sys_period_end timestamp; -create table migtest_e_history7_history( - id integer, - sys_period_start timestamp, - sys_period_end timestamp -); -create view migtest_e_history7_with_history as select * from migtest_e_history7 union all select * from migtest_e_history7_history; - -create trigger migtest_e_history7_history_upd before update,delete on migtest_e_history7 for each row call "io.ebean.config.dbplatform.h2.H2HistoryTrigger"; diff --git a/ebean-test/src/test/resources/dbmigration/migrationtest-history/1.2__dropsFor_1.1.sql b/ebean-test/src/test/resources/dbmigration/migrationtest-history/1.2__dropsFor_1.1.sql deleted file mode 100644 index 692d93f76..000000000 --- a/ebean-test/src/test/resources/dbmigration/migrationtest-history/1.2__dropsFor_1.1.sql +++ /dev/null @@ -1,10 +0,0 @@ --- Migrationscripts for ebean unittest DbMigrationDropHistoryTest --- drop dependencies -drop trigger migtest_e_history7_history_upd; -drop view migtest_e_history7_with_history; -alter table migtest_e_history7 drop column sys_period_start; -alter table migtest_e_history7 drop column sys_period_end; -drop table migtest_e_history7_history; - - --- apply changes diff --git a/ebean-test/src/test/resources/dbmigration/migrationtest-history/R__multi_comments.sql b/ebean-test/src/test/resources/dbmigration/migrationtest-history/R__multi_comments.sql deleted file mode 100644 index 0ede0c9eb..000000000 --- a/ebean-test/src/test/resources/dbmigration/migrationtest-history/R__multi_comments.sql +++ /dev/null @@ -1,3 +0,0 @@ - - -- h2 and postgres script - \ No newline at end of file diff --git a/ebean-test/src/test/resources/dbmigration/migrationtest-history/R__order_views.sql b/ebean-test/src/test/resources/dbmigration/migrationtest-history/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/test/resources/dbmigration/migrationtest-history/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.0__initial.model.xml b/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.0__initial.model.xml deleted file mode 100644 index 52d70c793..000000000 --- a/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.0__initial.model.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.1.model.xml b/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.1.model.xml deleted file mode 100644 index 8c0a04b2b..000000000 --- a/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.1.model.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.2__dropsFor_1.1.model.xml b/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.2__dropsFor_1.1.model.xml deleted file mode 100644 index 4cfc4672f..000000000 --- a/ebean-test/src/test/resources/dbmigration/migrationtest-history/model/1.2__dropsFor_1.1.model.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbinit/mysql/1.2.sql b/ebean-test/src/test/resources/migrationtest-procedures/dbinit/mysql/1.2.sql deleted file mode 100644 index ba478f705..000000000 --- a/ebean-test/src/test/resources/migrationtest-procedures/dbinit/mysql/1.2.sql +++ /dev/null @@ -1,9 +0,0 @@ --- Migrationscripts for ebean unittest --- apply changes -create table migtest_e_basic ( - id integer auto_increment not null, - status varchar(1), - name varchar(127), - constraint pk_migtest_e_basic primary key (id) -); - diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/I__create_procs.sql b/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/I__create_procs.sql deleted file mode 100644 index d13ec2708..000000000 --- a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/I__create_procs.sql +++ /dev/null @@ -1,48 +0,0 @@ --- Inital script to create stored procedures etc for mysql platform -DROP PROCEDURE IF EXISTS usp_ebean_drop_foreign_keys; - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_foreign_keys TABLE, COLUMN --- deletes all constraints and foreign keys referring to TABLE.COLUMN --- -CREATE PROCEDURE usp_ebean_drop_foreign_keys(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) -BEGIN -DECLARE done INT DEFAULT FALSE; -DECLARE c_fk_name CHAR(255); -DECLARE curs CURSOR FOR SELECT CONSTRAINT_NAME from information_schema.KEY_COLUMN_USAGE -WHERE TABLE_SCHEMA = DATABASE() and TABLE_NAME = p_table_name and COLUMN_NAME = p_column_name -AND REFERENCED_TABLE_NAME IS NOT NULL; -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN curs; - -read_loop: LOOP -FETCH curs INTO c_fk_name; -IF done THEN -LEAVE read_loop; -END IF; -SET @sql = CONCAT('ALTER TABLE ', p_table_name, ' DROP FOREIGN KEY ', c_fk_name); -PREPARE stmt FROM @sql; -EXECUTE stmt; -END LOOP; - -CLOSE curs; -END -$$ - -DROP PROCEDURE IF EXISTS usp_ebean_drop_column; - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_column TABLE, COLUMN --- deletes the column and ensures that all indices and constraints are dropped first --- -CREATE PROCEDURE usp_ebean_drop_column(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) -BEGIN -CALL usp_ebean_drop_foreign_keys(p_table_name, p_column_name); -SET @sql = CONCAT('ALTER TABLE ', p_table_name, ' DROP COLUMN ', p_column_name); -PREPARE stmt FROM @sql; -EXECUTE stmt; -END -$$ diff --git a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/R__order_views.sql b/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/R__order_views.sql deleted file mode 100644 index ccf30a2c6..000000000 --- a/ebean-test/src/test/resources/migrationtest-procedures/dbmigration/mysql/R__order_views.sql +++ /dev/null @@ -1,7 +0,0 @@ - - create or replace view order_agg_vw as - select d.order_id, sum(d.order_qty * d.unit_price) as order_total, - sum(d.ship_qty * d.unit_price) as ship_total - from o_order_detail d - group by d.order_id - \ No newline at end of file diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/R__db2_explain_tables.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/R__db2_explain_tables.sql deleted file mode 100644 index b2539a5ea..000000000 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/R__db2_explain_tables.sql +++ /dev/null @@ -1,8 +0,0 @@ - -delimiter $$ -BEGIN -IF NOT EXISTS (SELECT * FROM SYSCAT.TABLES WHERE TABSCHEMA = CURRENT SCHEMA AND TABNAME = 'EXPLAIN_STREAM') THEN -call SYSPROC.SYSINSTALLOBJECTS( 'EXPLAIN', 'C' , '', CURRENT SCHEMA ); -END IF; -END;$$ - \ No newline at end of file diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_db2.migrations deleted file mode 100644 index f47b2380c..000000000 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_db2.migrations +++ /dev/null @@ -1,8 +0,0 @@ -1391889205, 1.0__initial.sql -1929266342, 1.1.sql --1187336846, 1.2__dropsFor_1.1.sql --799135439, 1.3.sql --1713819679, 1.4__dropsFor_1.3.sql --133543359, R__db2_explain_tables.sql -561281075, R__order_views.sql - diff --git a/platforms/db2/src/main/java/io/ebean/platform/db2/BaseDB2Platform.java b/platforms/db2/src/main/java/io/ebean/platform/db2/BaseDB2Platform.java index ead2a5406..cb2b4d141 100644 --- a/platforms/db2/src/main/java/io/ebean/platform/db2/BaseDB2Platform.java +++ b/platforms/db2/src/main/java/io/ebean/platform/db2/BaseDB2Platform.java @@ -1,9 +1,5 @@ package io.ebean.platform.db2; -import java.sql.Types; - -import javax.sql.DataSource; - import io.ebean.BackgroundExecutor; import io.ebean.annotation.Platform; import io.ebean.config.dbplatform.DatabasePlatform; @@ -12,6 +8,9 @@ import io.ebean.config.dbplatform.DbType; import io.ebean.config.dbplatform.PlatformIdGenerator; import io.ebean.config.dbplatform.SqlErrorCodes; +import javax.sql.DataSource; +import java.sql.Types; + /** * DB2 specific platform. */