Class PlatformDdl
java.lang.Object
io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl
- Direct Known Subclasses:
AbstractHanaDdl,ClickHouseDdl,CockroachDdl,DB2Ddl,H2Ddl,HsqldbDdl,MySqlDdl,NuoDbDdl,OracleDdl,PostgresDdl,SQLiteDdl,SqlServerDdl
Controls the DDL generation for a specific database platform.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumnComment(DdlBuffer apply, String table, String column, String comment) Add column comment as a separate statement.voidaddHistoryTable(DdlWrite writer, AddHistoryTable addHistoryTable) Add history support to an existing table.voidaddTableComment(DdlBuffer apply, String tableName, String tableComment) Add table comment as a separate statement (from the create table statement).voidaddTablePartition(DdlBuffer apply, String partitionMode, String partitionColumn) voidaddTablespace(DdlBuffer apply, String tablespaceName, String indexTablespace, String lobTablespace) Adds tablespace declaration.voidalterColumn(DdlWrite writer, AlterColumn alter) Alter column setting (type, default value and not null constraint).alterTableAddCheckConstraint(String tableName, String checkConstraintName, String checkConstraint) Alter table adding the check constraint.voidalterTableAddColumn(DdlWrite writer, String tableName, Column column, boolean onHistoryTable, String defaultValue) voidalterTableAddColumn(DdlWrite writer, String tableName, String columnName, String columnType, String defaultValue) This method is used from DbTriggerBasedHistoryDdl to add the sysPeriodColumns.alterTableAddForeignKey(DdlOptions options, io.ebeaninternal.dbmigration.ddlgeneration.platform.WriteForeignKey request) Add foreign key.alterTableAddUniqueConstraint(String tableName, String uqName, String[] columns, String[] nullableColumns) Add a unique constraint to the table.voidalterTableDropColumn(DdlWrite writer, String tableName, String columnName) alterTableDropConstraint(String tableName, String constraintName) Drop a unique constraint from the table.alterTableDropForeignKey(String tableName, String fkName) Return the drop foreign key clause.alterTableDropUniqueConstraint(String tableName, String uniqueConstraintName) Drop a unique constraint from the table (Sometimes this is an index).alterTableTablespace(String tablename, String tableSpace, String indexSpace, String lobSpace) Moves the table to an other tablespace.asIdentityColumn(String columnDefn, DdlIdentity identity) Modify and return the column definition for autoincrement or identity definition.voidconfigure(io.ebean.config.DatabaseConfig config) Set configuration options.Convert the standard type to the platform specific type.convertDefaultValue(String dbDefault) Convert the DB column default literal to platform specific.createCheckConstraint(String ckName, String checkConstraint) Returns the check constraint.createDdlHandler(io.ebean.config.DatabaseConfig config) Create a DdlHandler for the specific database platform.createIndex(io.ebeaninternal.dbmigration.ddlgeneration.platform.WriteCreateIndex create) createSequence(String sequenceName, DdlIdentity identity) Generate and return the create sequence DDL.voidcreateWithHistory(DdlWrite writer, MTable table) Add history support to this table using the platform specific mechanism.voiddropHistoryTable(DdlWrite writer, DropHistoryTable dropHistoryTable) Drop history support for a given table.Return the drop index statement for known non concurrent index.Return the drop index statement.dropSequence(String sequenceName) Return the drop sequence statement (potentially with if exists clause).Return the drop table statement (potentially with if exists clause).voidgenerateEpilog(DdlWrite writer) Use this to generate an epilog.voidgenerateProlog(DdlWrite writer) Use this to generate a prolog for each script (stored procedures)Returns the database-specific "create table" command prefix.io.ebean.config.dbplatform.DatabasePlatformvoidinlineTableComment(DdlBuffer apply, String tableComment) Add an inline table comment to the create table statement.booleanReturn true if the platform includes storage engine clause.booleanReturn true if the table and column comments are included inline.booleanReturn true if foreign key reference constraints need to inlined with create table.booleanReturn true if unique constraints for nullable columns can be inlined as normal.voidregenerateHistoryTriggers(DdlWrite writer, String tableName) Regenerate the history triggers (or function) due to a column being added/dropped/excluded or included.setLockTimeout(int lockTimeoutSeconds) By default this does nothing returning null / no lock timeout.booleantableInlineForeignKey(io.ebeaninternal.dbmigration.ddlgeneration.platform.WriteForeignKey request) Return the foreign key constraint when used inline with create table.voidtableStorageEngine(DdlBuffer apply, String storageEngine) Add an table storage engine to the create table statement.io.ebean.config.dbplatform.IdTypeuseIdentityType(io.ebean.config.dbplatform.IdType modelIdentity) Return the identity type to use given the support in the underlying database platform for sequences and identity/autoincrement.voidwriteTableColumns(DdlBuffer apply, List<Column> columns, DdlIdentity identity) Write all the table columns converting to platform types as necessary.
-
Constructor Details
-
PlatformDdl
-
-
Method Details
-
configure
Set configuration options. -
createDdlHandler
Create a DdlHandler for the specific database platform. -
useIdentityType
public io.ebean.config.dbplatform.IdType useIdentityType(io.ebean.config.dbplatform.IdType modelIdentity) Return the identity type to use given the support in the underlying database platform for sequences and identity/autoincrement. -
asIdentityColumn
Modify and return the column definition for autoincrement or identity definition. -
isInlineComments
Return true if the table and column comments are included inline. -
isIncludeStorageEngine
Return true if the platform includes storage engine clause. -
isInlineForeignKeys
Return true if foreign key reference constraints need to inlined with create table. Ideally we don't do this as then the constraints are not named. Do this for SQLite. -
setLockTimeout
By default this does nothing returning null / no lock timeout. -
writeTableColumns
Write all the table columns converting to platform types as necessary. -
createCheckConstraint
Returns the check constraint. -
convertDefaultValue
Convert the DB column default literal to platform specific. -
alterTableDropForeignKey
Return the drop foreign key clause. -
convert
Convert the standard type to the platform specific type. -
createWithHistory
Add history support to this table using the platform specific mechanism. -
dropHistoryTable
Drop history support for a given table. -
addHistoryTable
Add history support to an existing table. -
regenerateHistoryTriggers
Regenerate the history triggers (or function) due to a column being added/dropped/excluded or included. -
createSequence
Generate and return the create sequence DDL. -
dropSequence
Return the drop sequence statement (potentially with if exists clause). -
dropTable
Return the drop table statement (potentially with if exists clause). -
dropIndex
Return the drop index statement for known non concurrent index. -
dropIndex
Return the drop index statement. -
createIndex
public String createIndex(io.ebeaninternal.dbmigration.ddlgeneration.platform.WriteCreateIndex create) -
tableInlineForeignKey
public String tableInlineForeignKey(io.ebeaninternal.dbmigration.ddlgeneration.platform.WriteForeignKey request) Return the foreign key constraint when used inline with create table. -
alterTableAddForeignKey
public String alterTableAddForeignKey(DdlOptions options, io.ebeaninternal.dbmigration.ddlgeneration.platform.WriteForeignKey request) Add foreign key. -
alterTableDropUniqueConstraint
Drop a unique constraint from the table (Sometimes this is an index). -
alterTableDropConstraint
Drop a unique constraint from the table. -
alterTableAddUniqueConstraint
public String alterTableAddUniqueConstraint(String tableName, String uqName, String[] columns, String[] nullableColumns) Add a unique constraint to the table.Overridden by MsSqlServer for specific null handling on unique constraints.
-
alterTableAddColumn
public void alterTableAddColumn(DdlWrite writer, String tableName, Column column, boolean onHistoryTable, String defaultValue) -
alterTableAddColumn
public void alterTableAddColumn(DdlWrite writer, String tableName, String columnName, String columnType, String defaultValue) This method is used from DbTriggerBasedHistoryDdl to add the sysPeriodColumns. -
alterTableDropColumn
-
isInlineUniqueWhenNullable
Return true if unique constraints for nullable columns can be inlined as normal. Returns false for MsSqlServer and DB2 due to it's not possible to to put a constraint on a nullable column -
alterTableAddCheckConstraint
public String alterTableAddCheckConstraint(String tableName, String checkConstraintName, String checkConstraint) Alter table adding the check constraint. -
alterColumn
Alter column setting (type, default value and not null constraint).Used by MySql, SQL Server, and HANA as these require all column attributes to be set together.
-
getPlatform
-
getUpdateNullWithDefault
-
inlineTableComment
Add an inline table comment to the create table statement. -
tableStorageEngine
Add an table storage engine to the create table statement. -
addTableComment
Add table comment as a separate statement (from the create table statement). -
addColumnComment
Add column comment as a separate statement. -
generateProlog
Use this to generate a prolog for each script (stored procedures) -
generateEpilog
Use this to generate an epilog. Will be added at the end of script -
getCreateTableCommandPrefix
Returns the database-specific "create table" command prefix. For HANA this is either "create column table" or "create row table", for all other databases it is "create table".- Returns:
- The "create table" command prefix
-
suppressPrimaryKeyOnPartition
-
addTablePartition
-
addTablespace
public void addTablespace(DdlBuffer apply, String tablespaceName, String indexTablespace, String lobTablespace) Adds tablespace declaration. Now only supported for db2. -
alterTableTablespace
public String alterTableTablespace(String tablename, String tableSpace, String indexSpace, String lobSpace) Moves the table to an other tablespace.
-