Add tablespace support for DB2

This commit is contained in:
Roland Praml committed 2022-03-22 17:03:38 +01:00
1 parent baddc76961
commit 3e4cc3b3d6
38 files changed
+1014 -27

No files matched your search

@@ -95,6 +95,10 @@ public class DbMigrationTest extends BaseTestCase {
if (isSqlServer() || isMariaDB() || isMySql() || isHana()) {
runScript("I__create_procs.sql");
}
if(isDb2()) {
runScript("I__create_tablespaces.sql");
}
runScript("1.0__initial.sql");
@@ -5,6 +5,7 @@ import io.ebean.annotation.DbJson;
import io.ebean.annotation.EnumValue;
import io.ebean.annotation.Index;
import io.ebean.annotation.NotNull;
import io.ebean.annotation.Tablespace;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -20,6 +21,10 @@ import java.util.List;
@Entity
@Table(name = "migtest_e_basic")
// Note: tablespaces are currently only supported for DB2
// to be prepared for future (when we support sql server filegroups),
// we allow to specify the DB-platform here
@Tablespace(value = "db2;TSTABLES;", index = "db2;INDEXTS;")
public class EBasic {
public enum Status {
@@ -5,8 +5,11 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import io.ebean.annotation.Tablespace;
@Entity
@Table(name = "migtest_e_history")
@Tablespace("db2;MAIN;")
public class EHistory {
@Id
@@ -56,7 +56,7 @@ public class EBasic {
"update ${table} set status = 'N' where id = 1" }, platforms = Platform.DB2)
@DbMigration(preAlter = "-- rename all collisions")
@Column(unique = true)
@Size(max=127)
@Size(max = 127)
String description;
@DbJson
@@ -5,6 +5,7 @@ import io.ebean.annotation.DbComment;
import io.ebean.annotation.DbMigration;
import io.ebean.annotation.History;
import io.ebean.annotation.Platform;
import io.ebean.annotation.Tablespace;
import javax.persistence.Entity;
import javax.persistence.Id;
@@ -14,6 +15,8 @@ import javax.persistence.Table;
@Table(name = "migtest_e_history")
@History
@DbComment("We have history now")
// TODO: Should we allow own table space for history?
@Tablespace("db2;MAIN;")
public class EHistory {
@Id
@@ -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("db2;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("db2;TSMASTER;")
public class MtmMaster {
@Id
@@ -5,8 +5,11 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import io.ebean.annotation.Tablespace;
@Entity
@Table(name = "migtest_e_history")
@Tablespace("db2;MAIN;")
public class EHistory {
@Id