diff --git a/ebean-test/src/test/resources/migrationtest-history/dbmigration/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest-history/dbmigration/1.0__initial.sql
index c2e2019a7..6c49b58a9 100644
--- a/ebean-test/src/test/resources/migrationtest-history/dbmigration/1.0__initial.sql
+++ b/ebean-test/src/test/resources/migrationtest-history/dbmigration/1.0__initial.sql
@@ -5,13 +5,15 @@ create table migtest_e_history7 (
constraint pk_migtest_e_history7 primary key (id)
);
+-- apply alter tables
alter table migtest_e_history7 add column sys_period_start timestamp default now();
alter table migtest_e_history7 add column sys_period_end timestamp;
+-- apply post alter
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/migrationtest-history/dbmigration/1.2__dropsFor_1.1.sql b/ebean-test/src/test/resources/migrationtest-history/dbmigration/1.2__dropsFor_1.1.sql
index 692d93f76..e335d7576 100644
--- a/ebean-test/src/test/resources/migrationtest-history/dbmigration/1.2__dropsFor_1.1.sql
+++ b/ebean-test/src/test/resources/migrationtest-history/dbmigration/1.2__dropsFor_1.1.sql
@@ -2,9 +2,8 @@
-- 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
+-- apply alter tables
+alter table migtest_e_history7 drop column sys_period_start;
+alter table migtest_e_history7 drop column sys_period_end;
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 1cc7b4b1d..4cbff61d6 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;
@@ -119,6 +120,8 @@ alter table migtest_e_history5 drop versioning;
update migtest_e_history6 set test_number1 = 42 where test_number1 is null;
alter table migtest_e_history6 drop versioning;
alter table "table" 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 "table" add column "select" varchar(255);
alter table migtest_ckey_detail add column one_key integer;
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 69a27f3a5..a918ec04f 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 @@
--1073246286, 1.0__initial.sql
-2043476851, 1.1.sql
+305924563, 1.0__initial.sql
+125684563, 1.1.sql
364066694, 1.2__dropsFor_1.1.sql
-1155358918, 1.3.sql
+1302478095, 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.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql
index 21013eea0..e7af33883 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;
@@ -119,6 +120,8 @@ alter table migtest_e_history5 drop versioning;
update migtest_e_history6 set test_number1 = 42 where test_number1 is null;
alter table migtest_e_history6 drop versioning;
alter table "table" 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 "table" add column "select" varchar(255);
alter table migtest_ckey_detail add column one_key integer;
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 880eb4bf6..bcaed3329 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 @@
-2054922533, 1.0__initial.sql
-1256892738, 1.1.sql
+-1962818378, 1.0__initial.sql
+-1558090526, 1.1.sql
364066694, 1.2__dropsFor_1.1.sql
-1760988648, 1.3.sql
+-29831669, 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.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql
index 2fb812410..298dd02fb 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;
@@ -119,6 +120,8 @@ alter table migtest_e_history5 drop versioning;
update migtest_e_history6 set test_number1 = 42 where test_number1 is null;
alter table migtest_e_history6 drop versioning;
alter table "table" 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 "table" add column "select" varchar(255);
alter table migtest_ckey_detail add column one_key integer;
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 9d4b61aa7..a1024ee7a 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 @@
--1519091511, 1.0__initial.sql
--370964456, 1.1.sql
+-1602289007, I__create_tablespaces.sql
+-295943649, 1.0__initial.sql
+1539839817, 1.1.sql
364066694, 1.2__dropsFor_1.1.sql
-591329540, 1.3.sql
+-1775325396, 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.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql
index 2fb812410..298dd02fb 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;
@@ -119,6 +120,8 @@ alter table migtest_e_history5 drop versioning;
update migtest_e_history6 set test_number1 = 42 where test_number1 is null;
alter table migtest_e_history6 drop versioning;
alter table "table" 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 "table" add column "select" varchar(255);
alter table migtest_ckey_detail add column one_key integer;
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 9d4b61aa7..e3223814a 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 @@
--1519091511, 1.0__initial.sql
--370964456, 1.1.sql
+-295943649, 1.0__initial.sql
+1539839817, 1.1.sql
364066694, 1.2__dropsFor_1.1.sql
-591329540, 1.3.sql
+-1775325396, 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.3.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml
index 1c266ccae..1609ed17f 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
@@ -41,6 +41,8 @@
+
+