Reference scripts

This commit is contained in:
Roland Praml
2022-03-22 11:14:40 +01:00
parent bcec447193
commit 4492fd6de5
11 changed files with 49 additions and 29 deletions
@@ -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";
@@ -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;
@@ -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;
@@ -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
@@ -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;
@@ -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
@@ -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;
@@ -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
@@ -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;
@@ -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
@@ -41,6 +41,8 @@
<uniqueConstraint name="uq_migtest_e_ref_name" columnNames="name" oneToOne="false" nullableColumns=""/>
</createTable>
<alterColumn columnName="&quot;index&quot;" tableName="&quot;table&quot;" withHistory="true" comment="this is a comment"/>
<alterTable name="migtest_mtm_c" tablespace="$TABLESPACE_DEFAULT" indexTablespace="$TABLESPACE_DEFAULT" lobTablespace="$TABLESPACE_DEFAULT"/>
<alterTable name="migtest_mtm_m" tablespace="$TABLESPACE_DEFAULT" indexTablespace="$TABLESPACE_DEFAULT" lobTablespace="$TABLESPACE_DEFAULT"/>
<addUniqueConstraint constraintName="uq_m12_otoc72" tableName="migtest_oto_child" columnNames="name" oneToOne="false" nullableColumns="name" platforms="MYSQL"/>
<addUniqueConstraint constraintName="uq_migtest_oto_master_name" tableName="migtest_oto_master" columnNames="name" oneToOne="false" nullableColumns="name" platforms="MYSQL"/>
<createIndex indexName="ix_migtest_e_basic_indextest1" tableName="migtest_e_basic" columns="indextest1"/>