mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
DB migration initial
This commit is contained in:
+215
-191
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
|
||||
<changeSet>
|
||||
<createTable name="ut_detail" sequenceName="ut_detail_seq">
|
||||
<column primaryKey="true" identity="true" name="id" type="integer"/>
|
||||
<column name="name" type="varchar(255)"/>
|
||||
<column name="qty" type="integer"/>
|
||||
<column name="amount" type="double"/>
|
||||
<column notnull="true" name="version" type="integer"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
</migration>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
|
||||
<changeSet>
|
||||
<createTable name="e_basic" sequenceName="e_basic_seq">
|
||||
<column primaryKey="true" identity="true" name="id" type="integer"/>
|
||||
<column checkConstraint="check (status in ('N','A','I'))" name="status" type="varchar(1)"/>
|
||||
<column name="name" type="varchar(255)"/>
|
||||
<column name="description" type="varchar(255)"/>
|
||||
<column name="some_date" type="timestamp"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
</migration>
|
||||
@@ -13,7 +13,8 @@ public class H2Platform extends DatabasePlatform {
|
||||
public H2Platform() {
|
||||
super();
|
||||
this.name = "h2";
|
||||
this.platformDdl = new H2Ddl(this.dbTypeMap);
|
||||
boolean useSequences = true;
|
||||
this.platformDdl = new H2Ddl(this.dbTypeMap, useSequences);
|
||||
this.dbEncrypt = new H2DbEncrypt();
|
||||
// like ? escape'' not working in the latest version H2 so just using no
|
||||
// escape clause for now noting that backslash is an escape char for like in H2
|
||||
|
||||
+26
-19
@@ -6,10 +6,10 @@ import com.avaje.ebean.dbmigration.ddlgeneration.TableDdl;
|
||||
import com.avaje.ebean.dbmigration.migration.Column;
|
||||
import com.avaje.ebean.dbmigration.migration.CreateTable;
|
||||
import com.avaje.ebean.dbmigration.migration.ForeignKey;
|
||||
import com.avaje.ebean.dbmigration.migration.PrimaryKey;
|
||||
import com.avaje.ebean.dbmigration.model.MTable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -54,29 +54,40 @@ public class BaseTableDdl implements TableDdl {
|
||||
if (!pk.isEmpty()) {
|
||||
// defined on the columns
|
||||
writePrimaryKeyConstraint(apply, tableName, toColumnNames(pk));
|
||||
} else {
|
||||
// defined on the table
|
||||
if (createTable.getPrimaryKey() == null) {
|
||||
System.out.print("asd");
|
||||
} else {
|
||||
writePrimaryKeyConstraint(apply, tableName, createTable.getPrimaryKey());
|
||||
}
|
||||
}
|
||||
|
||||
apply.newLine().append(")").endOfStatement();
|
||||
|
||||
// add drop table to the rollback buffer - do this before
|
||||
// we drop the related sequence (if sequences are used)
|
||||
dropTable(writer.rollback(), tableName);
|
||||
|
||||
writeSequence(writer, createTable);
|
||||
|
||||
// add blank line for a bit of whitespace between tables
|
||||
apply.end();
|
||||
writer.rollback().end();
|
||||
|
||||
writeAddForeignKeys(writer, createTable);
|
||||
|
||||
// add drop table to the rollback buffer
|
||||
dropTable(writer.rollback(), tableName);
|
||||
|
||||
if (isTrue(createTable.isWithHistory())) {
|
||||
createWithHistory(writer, createTable.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void writeSequence(DdlWrite writer, CreateTable createTable) throws IOException {
|
||||
String name = createTable.getSequenceName();
|
||||
int initial = toInt(createTable.getSequenceInitial());
|
||||
int allocate = toInt(createTable.getSequenceAllocate());
|
||||
|
||||
String createSeq = platformDdl.createSequence(name, initial, allocate);
|
||||
if (createSeq != null) {
|
||||
writer.apply().append(createSeq).newLine();
|
||||
writer.rollback().append(platformDdl.dropSequence(name));
|
||||
}
|
||||
}
|
||||
|
||||
private void createWithHistory(DdlWrite writer, String name) throws IOException {
|
||||
|
||||
MTable table = writer.getTable(name);
|
||||
@@ -183,7 +194,7 @@ public class BaseTableDdl implements TableDdl {
|
||||
*/
|
||||
protected void dropTable(DdlBuffer buffer, String tableName) throws IOException {
|
||||
|
||||
buffer.append("drop table ").append(tableName).endOfStatement().end();
|
||||
buffer.append("drop table ").append(tableName).endOfStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,13 +254,6 @@ public class BaseTableDdl implements TableDdl {
|
||||
buffer.append(")");
|
||||
}
|
||||
|
||||
protected void writePrimaryKeyConstraint(DdlBuffer buffer, String tableName, PrimaryKey pk) throws IOException {
|
||||
|
||||
String columnNames = pk.getColumnNames();
|
||||
String[] cols = columnNames.split(",");
|
||||
writePrimaryKeyConstraint(buffer, tableName, cols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the primary key constraint inline with the create table statement.
|
||||
*/
|
||||
@@ -390,5 +394,8 @@ public class BaseTableDdl implements TableDdl {
|
||||
return Boolean.TRUE.equals(value);
|
||||
}
|
||||
|
||||
private int toInt(BigInteger value) {
|
||||
return (value == null) ? 0 : value.intValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import com.avaje.ebean.config.dbplatform.DbTypeMap;
|
||||
*/
|
||||
public class H2Ddl extends PlatformDdl {
|
||||
|
||||
public H2Ddl(DbTypeMap platformTypes) {
|
||||
public H2Ddl(DbTypeMap platformTypes, boolean useSequences) {
|
||||
super(platformTypes, new H2HistoryDdl());
|
||||
this.foreignKeyRestrict = "on delete restrict on update restrict";
|
||||
this.useSequences = useSequences;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ public class PlatformDdl {
|
||||
|
||||
protected String foreignKeyRestrict = "";
|
||||
|
||||
protected boolean useSequences;
|
||||
|
||||
public PlatformDdl(DbTypeMap platformTypes, PlatformHistoryDdl historyDdl) {
|
||||
this.typeConverter = new PlatformTypeConverter(platformTypes);
|
||||
this.historyDdl = historyDdl;
|
||||
@@ -50,4 +52,31 @@ public class PlatformDdl {
|
||||
public void createWithHistory(DdlWrite writer, MTable table) throws IOException {
|
||||
historyDdl.createWithHistory(writer, table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and return the create sequence DDL.
|
||||
*/
|
||||
public String createSequence(String sequenceName, int initialValue, int allocationSize) {
|
||||
|
||||
if (!useSequences || sequenceName == null || sequenceName.trim().length() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder("create sequence ");
|
||||
sb.append(sequenceName);
|
||||
if (initialValue > 1) {
|
||||
sb.append(" start with ").append(initialValue);
|
||||
}
|
||||
if (allocationSize > 0 && allocationSize != 50) {
|
||||
// at this stage ignoring allocationSize 50 as this is the 'default' and
|
||||
// not consistent with the way Ebean batch fetches sequence values
|
||||
sb.append(" increment by ").append(allocationSize);
|
||||
}
|
||||
sb.append(";");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String dropSequence(String sequenceName) {
|
||||
return "drop sequence "+sequenceName+";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,13 @@ import com.avaje.ebean.config.dbplatform.DbTypeMap;
|
||||
public class PostgresDdl extends PlatformDdl {
|
||||
|
||||
public PostgresDdl(DbTypeMap platformTypes) {
|
||||
this(platformTypes, false);
|
||||
}
|
||||
|
||||
public PostgresDdl(DbTypeMap platformTypes, boolean useSequences) {
|
||||
super(platformTypes, new PostgresHistoryDdl());
|
||||
this.foreignKeyRestrict = "on delete restrict on update restrict";
|
||||
this.useSequences = useSequences;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
package com.avaje.ebean.dbmigration.migration;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@@ -8,6 +9,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
@@ -24,11 +26,13 @@ import javax.xml.bind.annotation.XmlType;
|
||||
* <element ref="{http://ebean-orm.github.io/xml/ns/dbmigration}column" maxOccurs="unbounded"/>
|
||||
* <element ref="{http://ebean-orm.github.io/xml/ns/dbmigration}uniqueConstraint" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element ref="{http://ebean-orm.github.io/xml/ns/dbmigration}foreignKey" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element ref="{http://ebean-orm.github.io/xml/ns/dbmigration}primaryKey" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attGroup ref="{http://ebean-orm.github.io/xml/ns/dbmigration}tablespaceAttributes"/>
|
||||
* <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="withHistory" type="{http://www.w3.org/2001/XMLSchema}boolean" />
|
||||
* <attribute name="sequenceName" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="sequenceInitial" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
|
||||
* <attribute name="sequenceAllocate" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
@@ -40,8 +44,7 @@ import javax.xml.bind.annotation.XmlType;
|
||||
@XmlType(name = "", propOrder = {
|
||||
"column",
|
||||
"uniqueConstraint",
|
||||
"foreignKey",
|
||||
"primaryKey"
|
||||
"foreignKey"
|
||||
})
|
||||
@XmlRootElement(name = "createTable")
|
||||
public class CreateTable {
|
||||
@@ -50,11 +53,18 @@ public class CreateTable {
|
||||
protected List<Column> column;
|
||||
protected List<UniqueConstraint> uniqueConstraint;
|
||||
protected List<ForeignKey> foreignKey;
|
||||
protected PrimaryKey primaryKey;
|
||||
@XmlAttribute(name = "name", required = true)
|
||||
protected String name;
|
||||
@XmlAttribute(name = "withHistory")
|
||||
protected Boolean withHistory;
|
||||
@XmlAttribute(name = "sequenceName")
|
||||
protected String sequenceName;
|
||||
@XmlAttribute(name = "sequenceInitial")
|
||||
@XmlSchemaType(name = "positiveInteger")
|
||||
protected BigInteger sequenceInitial;
|
||||
@XmlAttribute(name = "sequenceAllocate")
|
||||
@XmlSchemaType(name = "positiveInteger")
|
||||
protected BigInteger sequenceAllocate;
|
||||
@XmlAttribute(name = "tablespace")
|
||||
protected String tablespace;
|
||||
@XmlAttribute(name = "indexTablespace")
|
||||
@@ -149,30 +159,6 @@ public class CreateTable {
|
||||
return this.foreignKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the primaryKey property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link PrimaryKey }
|
||||
*
|
||||
*/
|
||||
public PrimaryKey getPrimaryKey() {
|
||||
return primaryKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the primaryKey property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link PrimaryKey }
|
||||
*
|
||||
*/
|
||||
public void setPrimaryKey(PrimaryKey value) {
|
||||
this.primaryKey = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
@@ -221,6 +207,78 @@ public class CreateTable {
|
||||
this.withHistory = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the sequenceName property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getSequenceName() {
|
||||
return sequenceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the sequenceName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setSequenceName(String value) {
|
||||
this.sequenceName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the sequenceInitial property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public BigInteger getSequenceInitial() {
|
||||
return sequenceInitial;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the sequenceInitial property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public void setSequenceInitial(BigInteger value) {
|
||||
this.sequenceInitial = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the sequenceAllocate property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public BigInteger getSequenceAllocate() {
|
||||
return sequenceAllocate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the sequenceAllocate property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public void setSequenceAllocate(BigInteger value) {
|
||||
this.sequenceAllocate = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the tablespace property.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
|
||||
package com.avaje.ebean.dbmigration.migration;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="columnNames" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="refColumnNames" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="refTableName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "")
|
||||
@XmlRootElement(name = "foreignKey")
|
||||
public class ForeignKey {
|
||||
|
||||
@XmlAttribute(name = "columnNames", required = true)
|
||||
protected String columnNames;
|
||||
@XmlAttribute(name = "refColumnNames", required = true)
|
||||
protected String refColumnNames;
|
||||
@XmlAttribute(name = "refTableName", required = true)
|
||||
protected String refTableName;
|
||||
|
||||
/**
|
||||
* Gets the value of the columnNames property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getColumnNames() {
|
||||
return columnNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the columnNames property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setColumnNames(String value) {
|
||||
this.columnNames = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the refColumnNames property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getRefColumnNames() {
|
||||
return refColumnNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the refColumnNames property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setRefColumnNames(String value) {
|
||||
this.refColumnNames = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the refTableName property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getRefTableName() {
|
||||
return refTableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the refTableName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setRefTableName(String value) {
|
||||
this.refTableName = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,14 +61,6 @@ public class ObjectFactory {
|
||||
return new ForeignKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link PrimaryKey }
|
||||
*
|
||||
*/
|
||||
public PrimaryKey createPrimaryKey() {
|
||||
return new PrimaryKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link DropForeignKey }
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.avaje.ebean.dbmigration.migration.CreateTable;
|
||||
import com.avaje.ebean.dbmigration.migration.DropColumn;
|
||||
import com.avaje.ebean.dbmigration.migration.ForeignKey;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -40,6 +41,9 @@ public class MTable {
|
||||
private String tablespace;
|
||||
|
||||
private String indexTablespace;
|
||||
private String sequenceName;
|
||||
private int sequenceInitial;
|
||||
private int sequenceAllocate;
|
||||
|
||||
private Boolean withHistory;
|
||||
|
||||
@@ -57,12 +61,16 @@ public class MTable {
|
||||
this.tablespace = createTable.getTablespace();
|
||||
this.indexTablespace = createTable.getIndexTablespace();
|
||||
this.withHistory = createTable.isWithHistory();
|
||||
this.sequenceName = createTable.getSequenceName();
|
||||
this.sequenceInitial = toInt(createTable.getSequenceInitial());
|
||||
this.sequenceAllocate = toInt(createTable.getSequenceAllocate());
|
||||
List<Column> cols = createTable.getColumn();
|
||||
for (Column column : cols) {
|
||||
addColumn(column);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct typically from EbeanServer meta data.
|
||||
*/
|
||||
@@ -78,6 +86,9 @@ public class MTable {
|
||||
createTable.setTablespace(tablespace);
|
||||
createTable.setIndexTablespace(indexTablespace);
|
||||
createTable.setWithHistory(withHistory);
|
||||
createTable.setSequenceName(sequenceName);
|
||||
createTable.setSequenceInitial(toBigInteger(sequenceInitial));
|
||||
createTable.setSequenceAllocate(toBigInteger(sequenceAllocate));
|
||||
|
||||
for (MColumn column : this.columns.values()) {
|
||||
createTable.getColumn().add(column.createColumn());
|
||||
@@ -148,6 +159,30 @@ public class MTable {
|
||||
return compoundKeys;
|
||||
}
|
||||
|
||||
public String getSequenceName() {
|
||||
return sequenceName;
|
||||
}
|
||||
|
||||
public void setSequenceName(String sequenceName) {
|
||||
this.sequenceName = sequenceName;
|
||||
}
|
||||
|
||||
public int getSequenceInitial() {
|
||||
return sequenceInitial;
|
||||
}
|
||||
|
||||
public void setSequenceInitial(int sequenceInitial) {
|
||||
this.sequenceInitial = sequenceInitial;
|
||||
}
|
||||
|
||||
public int getSequenceAllocate() {
|
||||
return sequenceAllocate;
|
||||
}
|
||||
|
||||
public void setSequenceAllocate(int sequenceAllocate) {
|
||||
this.sequenceAllocate = sequenceAllocate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of columns that make the primary key.
|
||||
*/
|
||||
@@ -203,4 +238,30 @@ public class MTable {
|
||||
compoundKeys.add(compoundKey);
|
||||
}
|
||||
|
||||
private int toInt(BigInteger value) {
|
||||
return (value == null) ? 0 : value.intValue();
|
||||
}
|
||||
|
||||
private BigInteger toBigInteger(int value) {
|
||||
return (value == 0) ? null : BigInteger.valueOf(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a column checking if it already exists and if so return the existing column.
|
||||
* Sometimes the case for a primaryKey that is also a foreign key.
|
||||
*/
|
||||
public MColumn addColumn(String dbCol, String columnDefn, boolean notnull) {
|
||||
|
||||
MColumn existingColumn = columns.get(dbCol);
|
||||
if (existingColumn != null) {
|
||||
if (notnull) {
|
||||
existingColumn.setNotnull(true);
|
||||
}
|
||||
return existingColumn;
|
||||
}
|
||||
|
||||
MColumn newCol = new MColumn(dbCol, columnDefn, notnull);
|
||||
addColumn(newCol);
|
||||
return newCol;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,11 @@ public class ModelContainer {
|
||||
* Add a table (typically from reading EbeanServer meta data).
|
||||
*/
|
||||
public void addTable(MTable table) {
|
||||
|
||||
if (table.getName().equalsIgnoreCase("item")) {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
tables.put(table.getName(), table);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ public class ModelBuildBeanVisitor implements BeanVisitor {
|
||||
|
||||
MTable table = new MTable(descriptor.getBaseTable());
|
||||
|
||||
table.setSequenceName(descriptor.getSequenceName());
|
||||
table.setSequenceInitial(descriptor.getSequenceInitialValue());
|
||||
table.setSequenceAllocate(descriptor.getSequenceAllocationSize());
|
||||
|
||||
// add the table to the model
|
||||
ctx.addTable(table);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.avaje.ebean.config.dbplatform.DbTypeMap;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanProperty;
|
||||
import com.avaje.ebean.dbmigration.model.MTable;
|
||||
import com.avaje.ebean.dbmigration.model.ModelContainer;
|
||||
import com.avaje.ebeaninternal.server.type.ScalarType;
|
||||
|
||||
/**
|
||||
* The context used during DDL generation.
|
||||
@@ -49,14 +50,23 @@ public class ModelBuildContext {
|
||||
if (p.isDbEncrypted()) {
|
||||
return dbTypeMap.get(p.getDbEncryptedType());
|
||||
}
|
||||
if (p.isLocalEncrypted()) {
|
||||
// scalar type potentially wrapping varbinary db type
|
||||
ScalarType<Object> scalarType = p.getScalarType();
|
||||
int jdbcType = scalarType.getJdbcType();
|
||||
return dbTypeMap.get(jdbcType);
|
||||
}
|
||||
|
||||
// ScalarType<Object> scalarType = p.getScalarType();
|
||||
// if (scalarType == null) {
|
||||
// throw new RuntimeException("No scalarType for " + p.getFullBeanName());
|
||||
// }
|
||||
// return dbTypeMap.get(scalarType.getJdbcType());
|
||||
|
||||
// can be the logical JSON types (JSON, JSONB, JSONClob, JSONBlob, JSONVarchar)
|
||||
int dbType = p.getDbType();
|
||||
if (dbType == 0) {
|
||||
// ScalarType<Object> scalarType = p.getScalarType();
|
||||
// if (scalarType == null) {
|
||||
throw new RuntimeException("No scalarType for " + p.getFullBeanName());
|
||||
// }
|
||||
// dbType = scalarType.getJdbcType();
|
||||
throw new RuntimeException("No scalarType defined for " + p.getFullBeanName());
|
||||
}
|
||||
return dbTypeMap.get(dbType);
|
||||
}
|
||||
|
||||
+32
-23
@@ -1,5 +1,7 @@
|
||||
package com.avaje.ebean.dbmigration.model.build;
|
||||
|
||||
import com.avaje.ebean.dbmigration.migration.ForeignKey;
|
||||
import com.avaje.ebean.dbmigration.model.MCompoundForeignKey;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanProperty;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
@@ -20,6 +22,8 @@ public class ModelBuildIntersectionTable {
|
||||
private final TableJoin intersectionTableJoin;
|
||||
private final TableJoin tableJoin;
|
||||
|
||||
private MTable intersectionTable;
|
||||
|
||||
public ModelBuildIntersectionTable(ModelBuildContext ctx, BeanPropertyAssocMany<?> manyProp) {
|
||||
this.ctx = ctx;
|
||||
this.manyProp = manyProp;
|
||||
@@ -29,44 +33,49 @@ public class ModelBuildIntersectionTable {
|
||||
|
||||
public void build() {
|
||||
|
||||
MTable table = createTable();
|
||||
ctx.addTable(table);
|
||||
intersectionTable = createTable();
|
||||
ctx.addTable(intersectionTable);
|
||||
|
||||
//buildFkConstraints();
|
||||
buildFkConstraints();
|
||||
}
|
||||
|
||||
// private void buildFkConstraints(MTable table) {
|
||||
//
|
||||
// BeanDescriptor<?> localDesc = manyProp.getBeanDescriptor();
|
||||
// String fk1 = buildFkConstraints(localDesc, intersectionTableJoin.columns(), true);
|
||||
// ctx.addIntersectionTableFk(fk1);
|
||||
//
|
||||
// BeanDescriptor<?> targetDesc = manyProp.getTargetDescriptor();
|
||||
// String fk2 = buildFkConstraints(targetDesc, tableJoin.columns(), false);
|
||||
// ctx.addIntersectionTableFk(fk2);
|
||||
// }
|
||||
private void buildFkConstraints() {
|
||||
|
||||
BeanDescriptor<?> localDesc = manyProp.getBeanDescriptor();
|
||||
buildFkConstraints(localDesc, intersectionTableJoin.columns(), true);
|
||||
//ctx.addIntersectionTableFk(fk1);
|
||||
|
||||
BeanDescriptor<?> targetDesc = manyProp.getTargetDescriptor();
|
||||
buildFkConstraints(targetDesc, tableJoin.columns(), false);
|
||||
//ctx.addIntersectionTableFk(fk2);
|
||||
}
|
||||
|
||||
|
||||
// private String buildFkConstraints(BeanDescriptor<?> desc, TableJoinColumn[] columns, boolean direction) {
|
||||
//
|
||||
//
|
||||
private void buildFkConstraints(BeanDescriptor<?> desc, TableJoinColumn[] columns, boolean direction) {
|
||||
|
||||
|
||||
// String fkName = "fk_"+intersectionTableJoin.getTable()+"_"+desc.getBaseTable();
|
||||
//
|
||||
// fkName = getFkNameWithSuffix(fkName);
|
||||
//
|
||||
|
||||
MCompoundForeignKey foreignKey = new MCompoundForeignKey(desc.getBaseTable());
|
||||
intersectionTable.addForeignKey(foreignKey);
|
||||
|
||||
|
||||
// fkBuf.append("alter table ");
|
||||
// fkBuf.append(intersectionTableJoin.getTable());
|
||||
// fkBuf.append(" add constraint ").append(fkName);
|
||||
//
|
||||
// fkBuf.append(" foreign key (");
|
||||
//
|
||||
// for (int i = 0; i < columns.length; i++) {
|
||||
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
// if (i > 0) {
|
||||
// fkBuf.append(", ");
|
||||
// }
|
||||
// String col = direction ? columns[i].getForeignDbColumn() : columns[i].getLocalDbColumn();
|
||||
// fkBuf.append(col);
|
||||
// }
|
||||
String localCol = direction ? columns[i].getForeignDbColumn() : columns[i].getLocalDbColumn();
|
||||
String refCol = !direction ? columns[i].getForeignDbColumn() : columns[i].getLocalDbColumn();
|
||||
foreignKey.addColumnPair(localCol, refCol);
|
||||
}
|
||||
// fkBuf.append(") references ").append(desc.getBaseTable()).append(" (");
|
||||
//
|
||||
// for (int i = 0; i < columns.length; i++) {
|
||||
@@ -86,7 +95,7 @@ public class ModelBuildIntersectionTable {
|
||||
// fkBuf.append(";").append(NEW_LINE);
|
||||
//
|
||||
// return fkBuf.toString();
|
||||
// }
|
||||
}
|
||||
|
||||
private MTable createTable() {
|
||||
|
||||
|
||||
+7
-2
@@ -99,16 +99,20 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
String columnDefn = ctx.getColumnDefn(importedProperty);
|
||||
String refColumn = importedProperty.getDbColumn();
|
||||
|
||||
MColumn col = new MColumn(dbCol, columnDefn, !p.isNullable());
|
||||
MColumn col = table.addColumn(dbCol, columnDefn, !p.isNullable());
|
||||
|
||||
if (columns.length == 1) {
|
||||
// single references column (put it on the column)
|
||||
String refTable = importedProperty.getBeanDescriptor().getBaseTable();
|
||||
if (refTable == null) {
|
||||
// odd case where an EmbeddedId only has 1 property
|
||||
refTable = p.getTargetDescriptor().getBaseTable();
|
||||
}
|
||||
col.setReferences(refTable + "." + refColumn);
|
||||
} else {
|
||||
compoundKey.addColumnPair(dbCol, refColumn);
|
||||
}
|
||||
modelColumns.add(col);
|
||||
table.addColumn(col);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +131,7 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
public void visitScalar(BeanProperty p) {
|
||||
|
||||
if (p.isSecondaryTable()) {
|
||||
lastColumn = null;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,10 +107,12 @@
|
||||
<xsd:element ref="column" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xsd:element ref="uniqueConstraint" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:element ref="foreignKey" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:element ref="primaryKey" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="withHistory" type="xsd:boolean"/>
|
||||
<xsd:attribute name="sequenceName" type="xsd:string"/>
|
||||
<xsd:attribute name="sequenceInitial" type="xsd:positiveInteger"/>
|
||||
<xsd:attribute name="sequenceAllocate" type="xsd:positiveInteger"/>
|
||||
<xsd:attributeGroup ref="tablespaceAttributes"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
@@ -132,13 +134,6 @@
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<!-- Only expected to be used for compound primary key -->
|
||||
<xsd:element name="primaryKey">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="columnNames" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="dropTable">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
|
||||
@@ -21,7 +21,7 @@ public class BaseDdlHandlerTest extends BaseTestCase {
|
||||
|
||||
private BaseDdlHandler h2Handler() {
|
||||
DbTypeMap types = new H2Platform().getDbTypeMap();
|
||||
return new BaseDdlHandler(new DdlNamingConvention(), new H2Ddl(types));
|
||||
return new BaseDdlHandler(new DdlNamingConvention(), new H2Ddl(types, true));
|
||||
}
|
||||
|
||||
private BaseDdlHandler postgresHandler() {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class BaseTableDdlTest {
|
||||
@Test
|
||||
public void testGenerate() throws Exception {
|
||||
|
||||
BaseTableDdl ddlGen = new BaseTableDdl(new DdlNamingConvention(), new H2Ddl(new DbTypeMap()));
|
||||
BaseTableDdl ddlGen = new BaseTableDdl(new DdlNamingConvention(), new H2Ddl(new DbTypeMap(), true));
|
||||
|
||||
DdlWrite write = new DdlWrite();
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class MigrationXmlWriterTest {
|
||||
@Test
|
||||
public void testWrite() throws Exception {
|
||||
|
||||
Migration migration = MigrationXmlReader.read("/test/container/test-create-table.xml");
|
||||
Migration migration = MigrationXmlReader.read("/container/test-create-table.xml");
|
||||
|
||||
File temp = File.createTempFile("migrationWrite",".xml");
|
||||
MigrationXmlWriter writer = new MigrationXmlWriter();
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ModelContainerApplyTest {
|
||||
@Test
|
||||
public void testApply() throws Exception {
|
||||
|
||||
Migration migration = MigrationXmlReader.read("/test/container/test-create-table.xml");
|
||||
Migration migration = MigrationXmlReader.read("/container/test-create-table.xml");
|
||||
|
||||
List<ChangeSet> changeSets = migration.getChangeSet();
|
||||
ChangeSet changeSet = changeSets.get(0);
|
||||
|
||||
+6
-1
@@ -25,9 +25,14 @@ public class ModelBuildBeanVisitorTest extends BaseTestCase {
|
||||
|
||||
new VisitAllUsing(addTable, defaultServer).visitAllBeans();
|
||||
|
||||
MTable item = model.getTable("item");
|
||||
|
||||
assertThat(item).isNotNull();
|
||||
assertThat(item.primaryKeyColumns()).hasSize(2);
|
||||
|
||||
MTable customer = model.getTable("o_customer");
|
||||
|
||||
assertThat(customer).isNotNull();
|
||||
|
||||
assertThat(customer.getSequenceName()).isNotNull();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,38 +1,424 @@
|
||||
drop table asimple_bean;
|
||||
drop sequence asimple_bean_seq;
|
||||
drop table bar;
|
||||
drop sequence bar_seq;
|
||||
drop table oto_account;
|
||||
drop sequence oto_account_seq;
|
||||
drop table o_address;
|
||||
|
||||
drop table blob_holder;
|
||||
drop sequence o_address_seq;
|
||||
drop table address;
|
||||
drop sequence address_seq;
|
||||
drop table animals;
|
||||
drop sequence animals_seq;
|
||||
drop table animal_shelter;
|
||||
drop sequence animal_shelter_seq;
|
||||
drop table article;
|
||||
drop sequence article_seq;
|
||||
drop table attribute;
|
||||
drop sequence attribute_seq;
|
||||
drop table attribute_holder;
|
||||
drop sequence attribute_holder_seq;
|
||||
drop table audit_log;
|
||||
drop sequence audit_log_seq;
|
||||
drop table bbookmark;
|
||||
drop sequence bbookmark_seq;
|
||||
drop table bbookmark_user;
|
||||
drop sequence bbookmark_user_seq;
|
||||
drop table bsimple_with_gen;
|
||||
drop sequence bsimple_with_gen_seq;
|
||||
drop table bwith_qident;
|
||||
drop sequence bwith_qident_seq;
|
||||
drop table basic_joda_entity;
|
||||
drop sequence basic_joda_entity_seq;
|
||||
drop table bean_with_time_zone;
|
||||
drop sequence bean_with_time_zone_seq;
|
||||
drop table drel_booking;
|
||||
drop sequence drel_booking_seq;
|
||||
drop table ckey_assoc;
|
||||
drop sequence ckey_assoc_seq;
|
||||
drop table ckey_detail;
|
||||
drop sequence ckey_detail_seq;
|
||||
drop table ckey_parent;
|
||||
drop sequence ckey_parent_seq;
|
||||
drop table calculation_result;
|
||||
drop sequence calculation_result_seq;
|
||||
drop table cao_bean;
|
||||
drop sequence cao_bean_seq;
|
||||
drop table sa_car;
|
||||
drop sequence sa_car_seq;
|
||||
drop table sp_car_car;
|
||||
drop sequence sp_car_car_seq;
|
||||
drop table sp_car_car_wheels;
|
||||
|
||||
drop table car_accessory;
|
||||
|
||||
drop table be_contact;
|
||||
|
||||
drop sequence car_accessory_seq;
|
||||
drop table configuration;
|
||||
drop sequence configuration_seq;
|
||||
drop table configurations;
|
||||
drop sequence configurations_seq;
|
||||
drop table contact;
|
||||
drop sequence contact_seq;
|
||||
drop table contact_group;
|
||||
drop sequence contact_group_seq;
|
||||
drop table contact_note;
|
||||
|
||||
drop sequence contact_note_seq;
|
||||
drop table c_conversation;
|
||||
drop sequence c_conversation_seq;
|
||||
drop table o_country;
|
||||
drop sequence o_country_seq;
|
||||
drop table o_customer;
|
||||
drop sequence o_customer_seq;
|
||||
drop table dexh_entity;
|
||||
drop sequence dexh_entity_seq;
|
||||
drop table dperson;
|
||||
drop sequence dperson_seq;
|
||||
drop table rawinherit_data;
|
||||
drop sequence rawinherit_data_seq;
|
||||
drop table e_basic;
|
||||
drop sequence e_basic_seq;
|
||||
drop table ebasic_clob;
|
||||
drop sequence ebasic_clob_seq;
|
||||
drop table ebasic_clob_fetch_eager;
|
||||
drop sequence ebasic_clob_fetch_eager_seq;
|
||||
drop table ebasic_clob_no_ver;
|
||||
drop sequence ebasic_clob_no_ver_seq;
|
||||
drop table e_basicenc;
|
||||
drop sequence e_basicenc_seq;
|
||||
drop table e_basicenc_bin;
|
||||
drop sequence e_basicenc_bin_seq;
|
||||
drop table e_basic_enum_id;
|
||||
drop sequence e_basic_enum_id_seq;
|
||||
drop table ebasic_json_map;
|
||||
drop sequence ebasic_json_map_seq;
|
||||
drop table ebasic_json_map_blob;
|
||||
drop sequence ebasic_json_map_blob_seq;
|
||||
drop table ebasic_json_map_json_b;
|
||||
drop sequence ebasic_json_map_json_b_seq;
|
||||
drop table ebasic_json_map_varchar;
|
||||
drop sequence ebasic_json_map_varchar_seq;
|
||||
drop table ebasic_json_node;
|
||||
drop sequence ebasic_json_node_seq;
|
||||
drop table ebasic_json_node_blob;
|
||||
drop sequence ebasic_json_node_blob_seq;
|
||||
drop table ebasic_json_node_json_b;
|
||||
drop sequence ebasic_json_node_json_b_seq;
|
||||
drop table ebasic_json_node_varchar;
|
||||
drop sequence ebasic_json_node_varchar_seq;
|
||||
drop table e_basic_ndc;
|
||||
drop sequence e_basic_ndc_seq;
|
||||
drop table e_basicver;
|
||||
drop sequence e_basicver_seq;
|
||||
drop table e_basic_withlife;
|
||||
drop sequence e_basic_withlife_seq;
|
||||
drop table e_basicverucon;
|
||||
drop sequence e_basicverucon_seq;
|
||||
drop table eemb_inner;
|
||||
drop sequence eemb_inner_seq;
|
||||
drop table eemb_outer;
|
||||
drop sequence eemb_outer_seq;
|
||||
drop table egen_props;
|
||||
drop sequence egen_props_seq;
|
||||
drop table einvoice;
|
||||
drop sequence einvoice_seq;
|
||||
drop table e_main;
|
||||
drop sequence e_main_seq;
|
||||
drop table enull_collection;
|
||||
drop sequence enull_collection_seq;
|
||||
drop table enull_collection_detail;
|
||||
drop sequence enull_collection_detail_seq;
|
||||
drop table eopt_one_a;
|
||||
drop sequence eopt_one_a_seq;
|
||||
drop table eopt_one_b;
|
||||
drop sequence eopt_one_b_seq;
|
||||
drop table eopt_one_c;
|
||||
drop sequence eopt_one_c_seq;
|
||||
drop table eperson;
|
||||
drop sequence eperson_seq;
|
||||
drop table esimple;
|
||||
|
||||
drop table be_customer;
|
||||
drop table esome_type;
|
||||
drop sequence esome_type_seq;
|
||||
drop table etrans_many;
|
||||
drop sequence etrans_many_seq;
|
||||
drop table evanilla_collection;
|
||||
drop sequence evanilla_collection_seq;
|
||||
drop table evanilla_collection_detail;
|
||||
drop sequence evanilla_collection_detail_seq;
|
||||
drop table ewho_props;
|
||||
drop sequence ewho_props_seq;
|
||||
drop table e_withinet;
|
||||
drop sequence e_withinet_seq;
|
||||
drop table td_child;
|
||||
drop sequence td_child_seq;
|
||||
drop table td_parent;
|
||||
drop sequence td_parent_seq;
|
||||
drop table feature_desc;
|
||||
drop sequence feature_desc_seq;
|
||||
drop table f_first;
|
||||
drop sequence f_first_seq;
|
||||
drop table foo;
|
||||
drop sequence foo_seq;
|
||||
drop table gen_key_identity;
|
||||
|
||||
drop table document;
|
||||
drop table gen_key_sequence;
|
||||
drop sequence SEQ;
|
||||
drop table gen_key_table;
|
||||
drop sequence gen_key_table_seq;
|
||||
drop table c_group;
|
||||
drop sequence c_group_seq;
|
||||
drop table imrelated;
|
||||
drop sequence imrelated_seq;
|
||||
drop table imroot;
|
||||
drop sequence imroot_seq;
|
||||
drop table ixresource;
|
||||
|
||||
drop table info_company;
|
||||
drop sequence info_company_seq;
|
||||
drop table info_contact;
|
||||
drop sequence info_contact_seq;
|
||||
drop table info_customer;
|
||||
drop sequence info_customer_seq;
|
||||
drop table inner_report;
|
||||
drop sequence inner_report_seq;
|
||||
drop table drel_invoice;
|
||||
drop sequence drel_invoice_seq;
|
||||
drop table item;
|
||||
drop sequence item_seq;
|
||||
drop table level1;
|
||||
drop sequence level1_seq;
|
||||
drop table level1_level4;
|
||||
|
||||
drop table level1_level2;
|
||||
|
||||
drop table level2;
|
||||
drop sequence level2_seq;
|
||||
drop table level2_level3;
|
||||
|
||||
drop table level3;
|
||||
drop sequence level3_seq;
|
||||
drop table level4;
|
||||
drop sequence level4_seq;
|
||||
drop table la_attr_value;
|
||||
drop sequence la_attr_value_seq;
|
||||
drop table la_attr_value_attribute;
|
||||
|
||||
drop table mmedia;
|
||||
drop sequence mmedia_seq;
|
||||
drop table non_updateprop;
|
||||
drop sequence non_updateprop_seq;
|
||||
drop table mprinter;
|
||||
drop sequence mprinter_seq;
|
||||
drop table mprinter_state;
|
||||
drop sequence mprinter_state_seq;
|
||||
drop table mprofile;
|
||||
drop sequence mprofile_seq;
|
||||
drop table mprotected_construct_bean;
|
||||
drop sequence mprotected_construct_bean_seq;
|
||||
drop table mrole;
|
||||
|
||||
drop sequence mrole_seq;
|
||||
drop table mrole_muser;
|
||||
|
||||
drop table msome_other;
|
||||
drop sequence msome_other_seq;
|
||||
drop table muser;
|
||||
|
||||
drop sequence muser_seq;
|
||||
drop table muser_type;
|
||||
drop sequence muser_type_seq;
|
||||
drop table map_super_actual;
|
||||
drop sequence map_super_actual_seq;
|
||||
drop table c_message;
|
||||
drop sequence c_message_seq;
|
||||
drop table mnoc_role;
|
||||
drop sequence mnoc_role_seq;
|
||||
drop table mnoc_user;
|
||||
drop sequence mnoc_user_seq;
|
||||
drop table mnoc_user_mnoc_role;
|
||||
|
||||
drop table o_booking;
|
||||
drop table mp_role;
|
||||
drop sequence mp_role_seq;
|
||||
drop table mp_user;
|
||||
drop sequence mp_user_seq;
|
||||
drop table my_lob_size;
|
||||
drop sequence my_lob_size_seq;
|
||||
drop table my_lob_size_join_many;
|
||||
drop sequence my_lob_size_join_many_seq;
|
||||
drop table noidbean;
|
||||
|
||||
drop table o_invoice;
|
||||
drop table o_cached_bean;
|
||||
drop sequence o_cached_bean_seq;
|
||||
drop table o_cached_bean_country;
|
||||
|
||||
drop table o_cached_bean_child;
|
||||
drop sequence o_cached_bean_child_seq;
|
||||
drop table ocar;
|
||||
drop sequence ocar_seq;
|
||||
drop table oengine;
|
||||
|
||||
drop table ogear_box;
|
||||
|
||||
drop table o_order;
|
||||
|
||||
drop sequence o_order_seq;
|
||||
drop table o_order_detail;
|
||||
drop sequence o_order_detail_seq;
|
||||
drop table s_orders;
|
||||
drop sequence s_orders_seq;
|
||||
drop table s_order_items;
|
||||
drop sequence s_order_items_seq;
|
||||
drop table or_order_ship;
|
||||
drop sequence or_order_ship_seq;
|
||||
drop table oto_child;
|
||||
drop sequence oto_child_seq;
|
||||
drop table oto_master;
|
||||
drop sequence oto_master_seq;
|
||||
drop table pfile;
|
||||
drop sequence pfile_seq;
|
||||
drop table pfile_content;
|
||||
drop sequence pfile_content_seq;
|
||||
drop table paggview;
|
||||
|
||||
drop table pallet_location;
|
||||
drop sequence pallet_location_seq;
|
||||
drop table parcel;
|
||||
drop sequence parcel_seq;
|
||||
drop table parcel_location;
|
||||
drop sequence parcel_location_seq;
|
||||
drop table rawinherit_parent;
|
||||
drop sequence rawinherit_parent_seq;
|
||||
drop table rawinherit_parent_rawinherit_dat;
|
||||
|
||||
drop table c_participation;
|
||||
drop sequence c_participation_seq;
|
||||
drop table mt_permission;
|
||||
|
||||
drop table persistent_file;
|
||||
drop sequence persistent_file_seq;
|
||||
drop table persistent_file_content;
|
||||
drop sequence persistent_file_content_seq;
|
||||
drop table PERSONS;
|
||||
drop sequence PERSONS_seq;
|
||||
drop table person;
|
||||
drop sequence person_seq;
|
||||
drop table PHONES;
|
||||
drop sequence PHONES_seq;
|
||||
drop table o_product;
|
||||
drop sequence o_product_seq;
|
||||
drop table pp;
|
||||
|
||||
drop table pp_to_ww;
|
||||
|
||||
drop table rcustomer;
|
||||
drop sequence rcustomer_seq;
|
||||
drop table r_orders;
|
||||
drop sequence r_orders_seq;
|
||||
drop table region;
|
||||
drop sequence region_seq;
|
||||
drop table ResourceFile;
|
||||
drop sequence ResourceFile_seq;
|
||||
drop table mt_role;
|
||||
|
||||
drop table mt_role_permission;
|
||||
|
||||
drop table em_role;
|
||||
drop sequence em_role_seq;
|
||||
drop table f_second;
|
||||
drop sequence f_second_seq;
|
||||
drop table section;
|
||||
drop sequence section_seq;
|
||||
drop table self_parent;
|
||||
drop sequence self_parent_seq;
|
||||
drop table self_ref_customer;
|
||||
drop sequence self_ref_customer_seq;
|
||||
drop table self_ref_example;
|
||||
drop sequence self_ref_example_seq;
|
||||
drop table some_enum_bean;
|
||||
drop sequence some_enum_bean_seq;
|
||||
drop table some_file_bean;
|
||||
drop sequence some_file_bean_seq;
|
||||
drop table some_new_types_bean;
|
||||
drop sequence some_new_types_bean_seq;
|
||||
drop table some_period_bean;
|
||||
drop sequence some_period_bean_seq;
|
||||
drop table stockforecast;
|
||||
drop sequence stockforecast_seq;
|
||||
drop table sub_section;
|
||||
drop sequence sub_section_seq;
|
||||
drop table sub_type;
|
||||
drop sequence sub_type_seq;
|
||||
drop table tbytes_only;
|
||||
drop sequence tbytes_only_seq;
|
||||
drop table tcar;
|
||||
drop sequence tcar_seq;
|
||||
drop table tint_root;
|
||||
drop sequence tint_root_seq;
|
||||
drop table tjoda_entity;
|
||||
drop sequence tjoda_entity_seq;
|
||||
drop table t_mapsuper1;
|
||||
drop sequence t_mapsuper1_seq;
|
||||
drop table t_oneb;
|
||||
drop sequence t_oneb_seq;
|
||||
drop table t_detail_with_other_namexxxyy;
|
||||
drop sequence t_atable_detail_seq;
|
||||
drop table ts_detail_two;
|
||||
drop sequence ts_detail_two_seq;
|
||||
drop table t_atable_thatisrelatively;
|
||||
drop sequence t_atable_master_seq;
|
||||
drop table ts_master_two;
|
||||
drop sequence ts_master_two_seq;
|
||||
drop table tuuid_entity;
|
||||
|
||||
drop table twheel;
|
||||
drop sequence twheel_seq;
|
||||
drop table twith_pre_insert;
|
||||
drop sequence twith_pre_insert_seq;
|
||||
drop table mt_tenant;
|
||||
|
||||
drop table sa_tire;
|
||||
drop sequence sa_tire_seq;
|
||||
drop table tire;
|
||||
drop sequence tire_seq;
|
||||
drop table trip;
|
||||
drop sequence trip_seq;
|
||||
drop table truck_ref;
|
||||
drop sequence truck_ref_seq;
|
||||
drop table type;
|
||||
drop sequence type_seq;
|
||||
drop table ut_detail;
|
||||
drop sequence ut_detail_seq;
|
||||
drop table ut_master;
|
||||
drop sequence ut_master_seq;
|
||||
drop table uuone;
|
||||
|
||||
drop table uutwo;
|
||||
|
||||
drop table em_user;
|
||||
drop sequence em_user_seq;
|
||||
drop table tx_user;
|
||||
drop sequence tx_user_seq;
|
||||
drop table c_user;
|
||||
drop sequence c_user_seq;
|
||||
drop table oto_user;
|
||||
drop sequence oto_user_seq;
|
||||
drop table em_user_role;
|
||||
drop sequence em_user_role_seq;
|
||||
drop table vehicle;
|
||||
drop sequence vehicle_seq;
|
||||
drop table vehicle_driver;
|
||||
drop sequence vehicle_driver_seq;
|
||||
drop table warehouses;
|
||||
drop sequence warehouses_seq;
|
||||
drop table WarehousesShippingZones;
|
||||
|
||||
drop table sa_wheel;
|
||||
drop sequence sa_wheel_seq;
|
||||
drop table sp_car_wheel;
|
||||
drop sequence sp_car_wheel_seq;
|
||||
drop table wheel;
|
||||
drop sequence wheel_seq;
|
||||
drop table with_zero;
|
||||
drop sequence with_zero_seq;
|
||||
drop table parent;
|
||||
drop sequence parent_seq;
|
||||
drop table wview;
|
||||
|
||||
drop table zones;
|
||||
drop sequence zones_seq;
|
||||
|
||||
Reference in New Issue
Block a user