From f19759103456a77350b9921e19b9c489bf7edc01 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 16 Mar 2022 15:23:02 +0100 Subject: [PATCH] Tablespace migrationen --- .../dbmigration/db2fori/1.0__initial.sql | 2 +- .../migrationtest/dbmigration/db2fori/1.1.sql | 9 ++++-- .../migrationtest/dbmigration/db2fori/1.3.sql | 2 ++ .../db2fori/R__db2_explain_tables.sql | 8 +++++ .../dbmigration/db2fori/idx_db2.migrations | 7 +++-- .../dbmigration/db2legacy/1.0__initial.sql | 2 +- .../dbmigration/db2legacy/1.1.sql | 9 ++++-- .../dbmigration/db2legacy/1.3.sql | 2 ++ .../db2legacy/R__db2_explain_tables.sql | 8 +++++ .../dbmigration/db2legacy/idx_db2.migrations | 7 +++-- .../dbmigration/db2luw/1.0__initial.sql | 2 +- .../migrationtest/dbmigration/db2luw/1.1.sql | 9 ++++-- .../migrationtest/dbmigration/db2luw/1.3.sql | 2 ++ .../db2luw/I__create_tablespaces.sql | 29 +++++++++++++++++++ .../db2luw/R__db2_explain_tables.sql | 8 +++++ .../dbmigration/db2luw/idx_db2.migrations | 8 +++-- .../dbmigration/db2zos/1.0__initial.sql | 2 +- .../migrationtest/dbmigration/db2zos/1.1.sql | 9 ++++-- .../migrationtest/dbmigration/db2zos/1.3.sql | 2 ++ .../db2zos/R__db2_explain_tables.sql | 8 +++++ .../dbmigration/db2zos/idx_db2.migrations | 7 +++-- .../dbmigration/model/1.0__initial.model.xml | 2 +- .../dbmigration/model/1.1.model.xml | 9 ++++-- .../dbmigration/model/1.3.model.xml | 2 ++ 24 files changed, 123 insertions(+), 32 deletions(-) create mode 100644 ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/R__db2_explain_tables.sql create mode 100644 ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/R__db2_explain_tables.sql create mode 100644 ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/I__create_tablespaces.sql create mode 100644 ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/R__db2_explain_tables.sql create mode 100644 ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/R__db2_explain_tables.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.0__initial.sql index cc23e8881..6143284ab 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.0__initial.sql @@ -75,7 +75,7 @@ create table migtest_e_basic ( constraint ck_migtest_e_basic_status check ( status in ('N','A','I')), constraint ck_migtest_e_basic_status2 check ( status2 in ('N','A','I')), constraint pk_migtest_e_basic primary key (id) -); +) in TSTABLES index in INDEXTS long in TSTABLES; create table migtest_e_enum ( id integer generated by default as identity not null, diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql index 298982766..01697ee76 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql @@ -87,18 +87,18 @@ 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_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; update migtest_e_basic set status = 'A' where status is null; @@ -107,6 +107,7 @@ update migtest_e_basic set status = 'A' where status is null; update migtest_e_basic set status = 'N' where id = 1; insert into migtest_e_user (id) select distinct user_id from migtest_e_basic; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_E_BASIC','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); -- NOTE: table has @History - special migration may be necessary update migtest_e_history2 set test_string = 'unknown' where test_string is null; @@ -118,6 +119,8 @@ alter table migtest_e_history5 drop versioning; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; alter table migtest_e_history6 drop versioning; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_C','TESTTS','TESTTS','TESTTS','','','','','','MOVE'); +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_M','TSMASTER','TSMASTER','TSMASTER','','','','','','MOVE'); -- apply alter tables alter table migtest_ckey_detail add column one_key integer; alter table migtest_ckey_detail add column two_key varchar(127); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.3.sql index 557ab8d29..496864267 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.3.sql @@ -165,6 +165,8 @@ alter table migtest_e_history6 drop versioning; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_C','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_M','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); -- apply alter tables alter table migtest_e_basic alter column status drop default; alter table migtest_e_basic alter column status drop not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/R__db2_explain_tables.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/R__db2_explain_tables.sql new file mode 100644 index 000000000..b2539a5ea --- /dev/null +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/R__db2_explain_tables.sql @@ -0,0 +1,8 @@ + +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/db2fori/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations index 7b05091cd..c3de90a92 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations @@ -1,7 +1,8 @@ --1173442860, 1.0__initial.sql --504970252, 1.1.sql +399416897, 1.0__initial.sql +234392641, 1.1.sql 364066694, 1.2__dropsFor_1.1.sql --2046803765, 1.3.sql +456341738, 1.3.sql -1199420632, 1.4__dropsFor_1.3.sql +-133543359, R__db2_explain_tables.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.0__initial.sql index cacec3063..794fd2fbb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.0__initial.sql @@ -75,7 +75,7 @@ create table migtest_e_basic ( constraint ck_mgtst__bsc_stts check ( status in ('N','A','I')), constraint ck_mgtst__b_z543fg check ( status2 in ('N','A','I')), constraint pk_migtest_e_basic primary key (id) -); +) in TSTABLES index in INDEXTS long in TSTABLES; create table migtest_e_enum ( id integer generated by default as identity not null, diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql index 4f0ea1cf5..b1b1e5951 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql @@ -87,18 +87,18 @@ 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_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; update migtest_e_basic set status = 'A' where status is null; @@ -107,6 +107,7 @@ update migtest_e_basic set status = 'A' where status is null; update migtest_e_basic set status = 'N' where id = 1; insert into migtest_e_user (id) select distinct user_id from migtest_e_basic; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_E_BASIC','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); -- NOTE: table has @History - special migration may be necessary update migtest_e_history2 set test_string = 'unknown' where test_string is null; @@ -118,6 +119,8 @@ alter table migtest_e_history5 drop versioning; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; alter table migtest_e_history6 drop versioning; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_C','TESTTS','TESTTS','TESTTS','','','','','','MOVE'); +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_M','TSMASTER','TSMASTER','TSMASTER','','','','','','MOVE'); -- apply alter tables alter table migtest_ckey_detail add column one_key integer; alter table migtest_ckey_detail add column two_key varchar(127); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.3.sql index 4dc9a692d..46a830ab8 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.3.sql @@ -165,6 +165,8 @@ alter table migtest_e_history6 drop versioning; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_C','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_M','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); -- apply alter tables alter table migtest_e_basic alter column status drop default; alter table migtest_e_basic alter column status drop not null; 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 new file mode 100644 index 000000000..b2539a5ea --- /dev/null +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/R__db2_explain_tables.sql @@ -0,0 +1,8 @@ + +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 index b3d6b8896..4ecb0df9e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_db2.migrations @@ -1,7 +1,8 @@ -1034179507, 1.0__initial.sql --1206845521, 1.1.sql +289288448, 1.0__initial.sql +1416632883, 1.1.sql 364066694, 1.2__dropsFor_1.1.sql -161683967, 1.3.sql +-355648343, 1.3.sql -1199420632, 1.4__dropsFor_1.3.sql +-133543359, R__db2_explain_tables.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql index d9e893947..86e44b829 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql @@ -75,7 +75,7 @@ create table migtest_e_basic ( constraint ck_migtest_e_basic_status check ( status in ('N','A','I')), constraint ck_migtest_e_basic_status2 check ( status2 in ('N','A','I')), constraint pk_migtest_e_basic primary key (id) -); +) in TSTABLES index in INDEXTS long in TSTABLES; create table migtest_e_enum ( id integer generated by default as identity not null, diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql index 77c49370e..d9ffdfb28 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql @@ -87,18 +87,18 @@ 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_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; update migtest_e_basic set status = 'A' where status is null; @@ -107,6 +107,7 @@ update migtest_e_basic set status = 'A' where status is null; update migtest_e_basic set status = 'N' where id = 1; insert into migtest_e_user (id) select distinct user_id from migtest_e_basic; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_E_BASIC','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); -- NOTE: table has @History - special migration may be necessary update migtest_e_history2 set test_string = 'unknown' where test_string is null; @@ -118,6 +119,8 @@ alter table migtest_e_history5 drop versioning; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; alter table migtest_e_history6 drop versioning; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_C','TESTTS','TESTTS','TESTTS','','','','','','MOVE'); +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_M','TSMASTER','TSMASTER','TSMASTER','','','','','','MOVE'); -- apply alter tables alter table migtest_ckey_detail add column one_key integer; alter table migtest_ckey_detail add column two_key varchar(127); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.3.sql index c0280ba4f..8769202e5 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.3.sql @@ -165,6 +165,8 @@ alter table migtest_e_history6 drop versioning; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_C','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_M','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); -- apply alter tables alter table migtest_e_basic alter column status drop default; alter table migtest_e_basic alter column status drop not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/I__create_tablespaces.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/I__create_tablespaces.sql new file mode 100644 index 000000000..e118fc1a1 --- /dev/null +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/I__create_tablespaces.sql @@ -0,0 +1,29 @@ + +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/test/resources/migrationtest/dbmigration/db2luw/R__db2_explain_tables.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/R__db2_explain_tables.sql new file mode 100644 index 000000000..b2539a5ea --- /dev/null +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/R__db2_explain_tables.sql @@ -0,0 +1,8 @@ + +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/db2luw/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations index 17aaf2093..94b73b7e2 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations @@ -1,7 +1,9 @@ --1345631840, 1.0__initial.sql -2135835079, 1.1.sql +-1602289007, I__create_tablespaces.sql +-1032235160, 1.0__initial.sql +-698103775, 1.1.sql 364066694, 1.2__dropsFor_1.1.sql --1510901098, 1.3.sql +-1759761341, 1.3.sql -1199420632, 1.4__dropsFor_1.3.sql +-133543359, R__db2_explain_tables.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.0__initial.sql index d9e893947..86e44b829 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.0__initial.sql @@ -75,7 +75,7 @@ create table migtest_e_basic ( constraint ck_migtest_e_basic_status check ( status in ('N','A','I')), constraint ck_migtest_e_basic_status2 check ( status2 in ('N','A','I')), constraint pk_migtest_e_basic primary key (id) -); +) in TSTABLES index in INDEXTS long in TSTABLES; create table migtest_e_enum ( id integer generated by default as identity not null, diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql index 77c49370e..d9ffdfb28 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql @@ -87,18 +87,18 @@ 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_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; update migtest_e_basic set status = 'A' where status is null; @@ -107,6 +107,7 @@ update migtest_e_basic set status = 'A' where status is null; update migtest_e_basic set status = 'N' where id = 1; insert into migtest_e_user (id) select distinct user_id from migtest_e_basic; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_E_BASIC','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); -- NOTE: table has @History - special migration may be necessary update migtest_e_history2 set test_string = 'unknown' where test_string is null; @@ -118,6 +119,8 @@ alter table migtest_e_history5 drop versioning; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number1 = 42 where test_number1 is null; alter table migtest_e_history6 drop versioning; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_C','TESTTS','TESTTS','TESTTS','','','','','','MOVE'); +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_M','TSMASTER','TSMASTER','TSMASTER','','','','','','MOVE'); -- apply alter tables alter table migtest_ckey_detail add column one_key integer; alter table migtest_ckey_detail add column two_key varchar(127); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.3.sql index c0280ba4f..8769202e5 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.3.sql @@ -165,6 +165,8 @@ alter table migtest_e_history6 drop versioning; -- NOTE: table has @History - special migration may be necessary update migtest_e_history6 set test_number2 = 7 where test_number2 is null; +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_C','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); +CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_MTM_M','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE'); -- apply alter tables alter table migtest_e_basic alter column status drop default; alter table migtest_e_basic alter column status drop not null; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/R__db2_explain_tables.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/R__db2_explain_tables.sql new file mode 100644 index 000000000..b2539a5ea --- /dev/null +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/R__db2_explain_tables.sql @@ -0,0 +1,8 @@ + +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/db2zos/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations index 17aaf2093..67ceb4461 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations @@ -1,7 +1,8 @@ --1345631840, 1.0__initial.sql -2135835079, 1.1.sql +-1032235160, 1.0__initial.sql +-698103775, 1.1.sql 364066694, 1.2__dropsFor_1.1.sql --1510901098, 1.3.sql +-1759761341, 1.3.sql -1199420632, 1.4__dropsFor_1.3.sql +-133543359, R__db2_explain_tables.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml index 69b8c6851..8bd06fa66 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml @@ -37,7 +37,7 @@ - + diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml index cab8491ca..0a2b63c9c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml @@ -46,6 +46,7 @@ + @@ -73,19 +74,21 @@ - + + - + + - + diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml index a8189b797..d607a5438 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml @@ -39,6 +39,8 @@ + +