mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-14 06:45:21 +00:00
NEU: Db2 Tablespaces (#59)
* first commit * second commit, it works for db2 * create table index in TS * IndexTS & runPlacholdersMap * Zwischencommit * Implemented Tablespaces * Update PR * Zwischencommit * release.md * add lobTablespace support * ebean-annotation 7.7 * create index in TS ausgebaut * Fix Mergekonflikte * Migrationsskripte neu generiert * Revert "Migrationsskripte neu generiert" This reverts commit 2690718b92701c0f34661d309c129b97e3cbe053. * Revert "Fix Mergekonflikte" This reverts commit e073e25048af88205259fd6b0873c4227b27d205. * revert merge commit * Resolved merge commits * FIX: More merge conflicts and compile errors * FIX: platform.base problem * tableName uppercase * Reviewkommentare Teil 1 * Reviewkommentare Teil 2 * DbMigrationTest für DB2 gefixt * revert whitespaces * Review * review Co-authored-by: Roland Praml <roland.praml@foconis.de>
This commit is contained in:
1 parent
09230924f7
commit
4fe6f0cb13
41 files changed
+996
-42
No files matched your search
@@ -74,6 +74,10 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
if (isSqlServer() || isMariaDB()) { // || isMySql()
|
||||
runScript("I__create_procs.sql");
|
||||
}
|
||||
|
||||
if(isDb2()) {
|
||||
runScript("I__create_tablespaces.sql");
|
||||
}
|
||||
|
||||
runScript("1.0__initial.sql");
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.ebean.annotation.DbDefault;
|
||||
import io.ebean.annotation.EnumValue;
|
||||
import io.ebean.annotation.Index;
|
||||
import io.ebean.annotation.NotNull;
|
||||
import io.ebean.annotation.Tablespace;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
@@ -14,6 +15,7 @@ import java.sql.Timestamp;
|
||||
|
||||
@Entity
|
||||
@Table(name = "migtest_e_basic")
|
||||
@Tablespace(value = "TSTABLES", index = "INDEXTS")
|
||||
public class EBasic {
|
||||
|
||||
public enum Status {
|
||||
|
||||
@@ -4,10 +4,14 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import io.ebean.annotation.Tablespace;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "migtest_mtm_c")
|
||||
@Tablespace("TESTTS")
|
||||
public class MtmChild {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -5,10 +5,14 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import io.ebean.annotation.Tablespace;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "migtest_mtm_m")
|
||||
@Tablespace("TSMASTER")
|
||||
public class MtmMaster {
|
||||
|
||||
@Id
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ import io.ebean.CountDistinctOrder;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.annotation.Identity;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
|
||||
@@ -72,5 +72,36 @@ call SYSPROC.SYSINSTALLOBJECTS( 'EXPLAIN', 'C' , '', CURRENT SCHEMA );
|
||||
END IF;
|
||||
END;$$
|
||||
</ddl-script>
|
||||
|
||||
<ddl-script name="create tablespaces" platforms="db2luw" init="true">
|
||||
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
|
||||
$$
|
||||
</ddl-script>
|
||||
|
||||
</extra-ddl>
|
||||
@@ -74,7 +74,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 unique index uq_migtest_e_basic_indextest2 on migtest_e_basic(indextest2) exclude null keys;
|
||||
create unique index uq_migtest_e_basic_indextest6 on migtest_e_basic(indextest6) exclude null keys;
|
||||
|
||||
|
||||
@@ -9,18 +9,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;
|
||||
|
||||
alter table migtest_ckey_detail add column one_key integer;
|
||||
alter table migtest_ckey_detail add column two_key varchar(127);
|
||||
@@ -119,6 +119,7 @@ create unique index uq_migtest_e_basic_status_indextest1 on migtest_e_basic(stat
|
||||
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;
|
||||
CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_E_BASIC','USERSPACE1','USERSPACE1','USERSPACE1','','','','','','MOVE');
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select constname from syscat.tabconst where tabschema = current_schema and constname = 'CK_MIGTEST_E_ENUM_TEST_STATUS' and tabname = 'MIGTEST_E_ENUM') then
|
||||
@@ -152,6 +153,8 @@ alter table migtest_e_history6 alter column test_number1 set not null;
|
||||
alter table migtest_e_history6 alter column test_number2 drop not null;
|
||||
alter table migtest_e_softdelete add column deleted boolean default false not null;
|
||||
|
||||
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');
|
||||
alter table migtest_oto_child add column master_id bigint;
|
||||
|
||||
call sysproc.admin_cmd('reorg table migtest_e_history6') /* reorg #6 */;
|
||||
|
||||
@@ -183,6 +183,8 @@ call sysproc.admin_cmd('reorg table migtest_e_history4') /* reorg #6 */;
|
||||
update migtest_e_history6 set test_number2 = 7 where test_number2 is null;
|
||||
alter table migtest_e_history6 alter column test_number2 set default 7;
|
||||
alter table migtest_e_history6 alter column test_number2 set not 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');
|
||||
call sysproc.admin_cmd('reorg table migtest_e_history6') /* reorg #7 */;
|
||||
create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1);
|
||||
create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5);
|
||||
|
||||
+29
@@ -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
|
||||
$$
|
||||
@@ -1,7 +1,8 @@
|
||||
1580812656, 1.0__initial.sql
|
||||
-2144208808, 1.1.sql
|
||||
-1602289007, I__create_tablespaces.sql
|
||||
999346633, 1.0__initial.sql
|
||||
2079409430, 1.1.sql
|
||||
1091886546, 1.2__dropsFor_1.1.sql
|
||||
-1041850370, 1.3.sql
|
||||
-1291483335, 1.3.sql
|
||||
1293885677, 1.4__dropsFor_1.3.sql
|
||||
-133543359, R__db2_explain_tables.sql
|
||||
561281075, R__order_views.sql
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
<column name="id" type="bigint" primaryKey="true"/>
|
||||
<column name="one_id" type="bigint" references="migtest_fk_one.id" foreignKeyName="fk_migtest_fk_set_null_one_id" foreignKeyIndex="ix_migtest_fk_set_null_one_id" foreignKeyOnDelete="SET_NULL" foreignKeyOnUpdate="RESTRICT"/>
|
||||
</createTable>
|
||||
<createTable name="migtest_e_basic" pkName="pk_migtest_e_basic">
|
||||
<createTable name="migtest_e_basic" pkName="pk_migtest_e_basic" tablespace="TSTABLES" indexTablespace="INDEXTS" lobTablespace="TSTABLES">
|
||||
<column name="id" type="integer" primaryKey="true"/>
|
||||
<column name="status" type="varchar(1)" checkConstraint="check ( status in ('N','A','I'))" checkConstraintName="ck_migtest_e_basic_status"/>
|
||||
<column name="status2" type="varchar(1)" defaultValue="'N'" notnull="true" checkConstraint="check ( status2 in ('N','A','I'))" checkConstraintName="ck_migtest_e_basic_status2"/>
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
<addUniqueConstraint constraintName="uq_migtest_e_basic_name" tableName="migtest_e_basic" columnNames="name" oneToOne="false" nullableColumns="name"/>
|
||||
<addUniqueConstraint constraintName="uq_migtest_e_basic_indextest4" tableName="migtest_e_basic" columnNames="indextest4" oneToOne="false" nullableColumns="indextest4"/>
|
||||
<addUniqueConstraint constraintName="uq_migtest_e_basic_indextest5" tableName="migtest_e_basic" columnNames="indextest5" oneToOne="false" nullableColumns="indextest5"/>
|
||||
<alterTable name="migtest_e_basic" tablespace="$TABLESPACE_DEFAULT" indexTablespace="$TABLESPACE_DEFAULT" lobTablespace="$TABLESPACE_DEFAULT"/>
|
||||
<alterColumn columnName="test_status" tableName="migtest_e_enum" dropCheckConstraint="ck_migtest_e_enum_test_status"/>
|
||||
<addHistoryTable baseTable="migtest_e_history"/>
|
||||
<alterColumn columnName="test_string" tableName="migtest_e_history" type="bigint" currentType="varchar" currentNotnull="false" comment="Column altered to long now">
|
||||
@@ -81,19 +82,21 @@
|
||||
<createTable name="migtest_e_user" pkName="pk_migtest_e_user">
|
||||
<column name="id" type="integer" primaryKey="true"/>
|
||||
</createTable>
|
||||
<createTable name="migtest_mtm_c_migtest_mtm_m" pkName="pk_migtest_mtm_c_migtest_mtm_m">
|
||||
<alterTable name="migtest_mtm_c" tablespace="TESTTS" indexTablespace="TESTTS" lobTablespace="TESTTS"/>
|
||||
<createTable name="migtest_mtm_c_migtest_mtm_m" pkName="pk_migtest_mtm_c_migtest_mtm_m" tablespace="TESTTS" indexTablespace="TESTTS" lobTablespace="TESTTS">
|
||||
<column name="migtest_mtm_c_id" type="integer" notnull="true" primaryKey="true"/>
|
||||
<column name="migtest_mtm_m_id" type="bigint" notnull="true" primaryKey="true"/>
|
||||
<foreignKey name="fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c" columnNames="migtest_mtm_c_id" refColumnNames="id" refTableName="migtest_mtm_c" indexName="ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c"/>
|
||||
<foreignKey name="fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m" columnNames="migtest_mtm_m_id" refColumnNames="id" refTableName="migtest_mtm_m" indexName="ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m"/>
|
||||
</createTable>
|
||||
<createTable name="migtest_mtm_m_migtest_mtm_c" pkName="pk_migtest_mtm_m_migtest_mtm_c">
|
||||
<alterTable name="migtest_mtm_m" tablespace="TSMASTER" indexTablespace="TSMASTER" lobTablespace="TSMASTER"/>
|
||||
<createTable name="migtest_mtm_m_migtest_mtm_c" pkName="pk_migtest_mtm_m_migtest_mtm_c" tablespace="TSMASTER" indexTablespace="TSMASTER" lobTablespace="TSMASTER">
|
||||
<column name="migtest_mtm_m_id" type="bigint" notnull="true" primaryKey="true"/>
|
||||
<column name="migtest_mtm_c_id" type="integer" notnull="true" primaryKey="true"/>
|
||||
<foreignKey name="fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m" columnNames="migtest_mtm_m_id" refColumnNames="id" refTableName="migtest_mtm_m" indexName="ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m"/>
|
||||
<foreignKey name="fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c" columnNames="migtest_mtm_c_id" refColumnNames="id" refTableName="migtest_mtm_c" indexName="ix_migtest_mtm_m_migtest_mtm_c_migtest_mtm_c"/>
|
||||
</createTable>
|
||||
<createTable name="migtest_mtm_m_phone_numbers" pkName="pk_migtest_mtm_m_phone_numbers">
|
||||
<createTable name="migtest_mtm_m_phone_numbers" pkName="pk_migtest_mtm_m_phone_numbers" tablespace="TSMASTER" indexTablespace="TSMASTER" lobTablespace="TSMASTER">
|
||||
<column name="migtest_mtm_m_id" type="bigint" notnull="true" references="migtest_mtm_m.id" foreignKeyName="fk_migtest_mtm_m_phone_numbers_migtest_mtm_m_id" foreignKeyIndex="ix_migtest_mtm_m_phone_numbers_migtest_mtm_m_id"/>
|
||||
<column name="value" type="varchar" notnull="true"/>
|
||||
</createTable>
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
<column name="name" type="varchar(127)" notnull="true"/>
|
||||
<uniqueConstraint name="uq_migtest_e_ref_name" columnNames="name" oneToOne="false" nullableColumns=""/>
|
||||
</createTable>
|
||||
<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"/>
|
||||
|
||||
Reference in new issue
Block a user