Class MySqlDdl
- java.lang.Object
-
- io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl
-
- io.ebeaninternal.dbmigration.ddlgeneration.platform.MySqlDdl
-
- Direct Known Subclasses:
MariaDbDdl
public class MySqlDdl extends PlatformDdl
MySql specific DDL.
-
-
Constructor Summary
Constructors Constructor Description MySqlDdl(io.ebean.config.dbplatform.DatabasePlatform platform)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumnComment(DdlBuffer apply, String table, String column, String comment)Add column comment as a separate statement.voidaddTableComment(DdlBuffer apply, String tableName, String tableComment)Add table comment as a separate statement (from the create table statement).StringalterColumnBaseAttributes(AlterColumn alter)Alter column setting both the type and not null constraint.StringalterColumnDefaultValue(String tableName, String columnName, String defaultValue)Alter column setting the default value.StringalterColumnNotnull(String tableName, String columnName, boolean notnull)Alter a column adding or removing the not null constraint.StringalterColumnType(String tableName, String columnName, String type)Alter a column type.StringalterTableAddCheckConstraint(String tableName, String checkConstraintName, String checkConstraint)Alter table adding the check constraint.StringalterTableDropConstraint(String tableName, String constraintName)Drop a unique constraint from the table.StringalterTableDropForeignKey(String tableName, String fkName)Return the drop foreign key clause.StringcreateCheckConstraint(String ckName, String checkConstraint)Returns the check constraint.StringdropIndex(String indexName, String tableName, boolean concurrent)Return the drop index statement.voidinlineTableComment(DdlBuffer apply, String tableComment)Add an inline table comment to the create table statement.voidlockTables(DdlBuffer buffer, Collection<String> tables)Locks all tables for triggers that have to be updated.voidunlockTables(DdlBuffer buffer, Collection<String> tables)Unlocks all tables for triggers that have to be updated.-
Methods inherited from class io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl
addHistoryTable, addTablePartition, alterTableAddColumn, alterTableAddForeignKey, alterTableAddUniqueConstraint, alterTableDropColumn, alterTableDropUniqueConstraint, asIdentityColumn, configure, convert, convertDefaultValue, createDdlHandler, createIndex, createSequence, createWithHistory, dropHistoryTable, dropIndex, dropSequence, dropTable, generateEpilog, generateProlog, getCreateTableCommandPrefix, getPlatform, getUpdateNullWithDefault, isIncludeStorageEngine, isInlineComments, isInlineForeignKeys, isInlineUniqueWhenNullable, regenerateHistoryTriggers, setLockTimeout, suppressPrimaryKeyOnPartition, tableInlineForeignKey, tableStorageEngine, useIdentityType, writeTableColumns
-
-
-
-
Constructor Detail
-
MySqlDdl
public MySqlDdl(io.ebean.config.dbplatform.DatabasePlatform platform)
-
-
Method Detail
-
dropIndex
public String dropIndex(String indexName, String tableName, boolean concurrent)
Return the drop index statement.- Overrides:
dropIndexin classPlatformDdl
-
alterTableDropForeignKey
public String alterTableDropForeignKey(String tableName, String fkName)
Return the drop foreign key clause.- Overrides:
alterTableDropForeignKeyin classPlatformDdl
-
createCheckConstraint
public String createCheckConstraint(String ckName, String checkConstraint)
Description copied from class:PlatformDdlReturns the check constraint.- Overrides:
createCheckConstraintin classPlatformDdl
-
alterTableAddCheckConstraint
public String alterTableAddCheckConstraint(String tableName, String checkConstraintName, String checkConstraint)
Description copied from class:PlatformDdlAlter table adding the check constraint.- Overrides:
alterTableAddCheckConstraintin classPlatformDdl
-
alterTableDropConstraint
public String alterTableDropConstraint(String tableName, String constraintName)
Description copied from class:PlatformDdlDrop a unique constraint from the table.- Overrides:
alterTableDropConstraintin classPlatformDdl
-
alterColumnType
public String alterColumnType(String tableName, String columnName, String type)
Description copied from class:PlatformDdlAlter a column type.Note that that MySql and SQL Server instead use alterColumnBaseAttributes()
- Overrides:
alterColumnTypein classPlatformDdl
-
alterColumnNotnull
public String alterColumnNotnull(String tableName, String columnName, boolean notnull)
Description copied from class:PlatformDdlAlter a column adding or removing the not null constraint.Note that that MySql, SQL Server, and HANA instead use alterColumnBaseAttributes()
- Overrides:
alterColumnNotnullin classPlatformDdl
-
alterColumnDefaultValue
public String alterColumnDefaultValue(String tableName, String columnName, String defaultValue)
Description copied from class:PlatformDdlAlter column setting the default value.- Overrides:
alterColumnDefaultValuein classPlatformDdl
-
alterColumnBaseAttributes
public String alterColumnBaseAttributes(AlterColumn alter)
Description copied from class:PlatformDdlAlter column setting both the type and not null constraint.Used by MySql, SQL Server, and HANA as these require both column attributes to be set together.
- Overrides:
alterColumnBaseAttributesin classPlatformDdl
-
inlineTableComment
public void inlineTableComment(DdlBuffer apply, String tableComment) throws IOException
Description copied from class:PlatformDdlAdd an inline table comment to the create table statement.- Overrides:
inlineTableCommentin classPlatformDdl- Throws:
IOException
-
addTableComment
public void addTableComment(DdlBuffer apply, String tableName, String tableComment) throws IOException
Add table comment as a separate statement (from the create table statement).- Overrides:
addTableCommentin classPlatformDdl- Throws:
IOException
-
addColumnComment
public void addColumnComment(DdlBuffer apply, String table, String column, String comment)
Description copied from class:PlatformDdlAdd column comment as a separate statement.- Overrides:
addColumnCommentin classPlatformDdl
-
lockTables
public void lockTables(DdlBuffer buffer, Collection<String> tables) throws IOException
Locks all tables for triggers that have to be updated.- Overrides:
lockTablesin classPlatformDdl- Throws:
IOException
-
unlockTables
public void unlockTables(DdlBuffer buffer, Collection<String> tables) throws IOException
Unlocks all tables for triggers that have to be updated.- Overrides:
unlockTablesin classPlatformDdl- Throws:
IOException
-
-