Class MySqlDdl
- java.lang.Object
-
- io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl
-
- io.ebeaninternal.dbmigration.ddlgeneration.platform.MySqlDdl
-
public class MySqlDdl extends PlatformDdl
MySql specific DDL.
-
-
Constructor Summary
Constructors Constructor Description MySqlDdl(DatabasePlatform platform)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumnComment(DdlBuffer apply, String table, String column, String comment)
Add column comment as a separate statement.void
addTableComment(DdlBuffer apply, String tableName, String tableComment)
Add table comment as a separate statement (from the create table statement).String
alterColumnBaseAttributes(AlterColumn alter)
Alter column setting both the type and not null constraint.String
alterColumnDefaultValue(String tableName, String columnName, String defaultValue)
Alter column setting the default value.String
alterColumnNotnull(String tableName, String columnName, boolean notnull)
Alter a column adding or removing the not null constraint.String
alterColumnType(String tableName, String columnName, String type)
Alter a column type.String
alterTableAddCheckConstraint(String tableName, String checkConstraintName, String checkConstraint)
Alter table adding the check constraint.String
alterTableDropConstraint(String tableName, String constraintName)
Drop a unique constraint from the table.String
alterTableDropForeignKey(String tableName, String fkName)
Return the drop foreign key clause.String
createCheckConstraint(String ckName, String checkConstraint)
Returns the check constraint.String
dropIndex(String indexName, String tableName, boolean concurrent)
Return the drop index statement.void
inlineTableComment(DdlBuffer apply, String tableComment)
Add an inline table comment to the create table statement.void
lockTables(DdlBuffer buffer, Collection<String> tables)
Locks all tables for triggers that have to be updated.void
unlockTables(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(DatabasePlatform platform)
-
-
Method Detail
-
dropIndex
public String dropIndex(String indexName, String tableName, boolean concurrent)
Return the drop index statement.- Overrides:
dropIndex
in classPlatformDdl
-
alterTableDropForeignKey
public String alterTableDropForeignKey(String tableName, String fkName)
Return the drop foreign key clause.- Overrides:
alterTableDropForeignKey
in classPlatformDdl
-
createCheckConstraint
public String createCheckConstraint(String ckName, String checkConstraint)
Description copied from class:PlatformDdl
Returns the check constraint.- Overrides:
createCheckConstraint
in classPlatformDdl
-
alterTableAddCheckConstraint
public String alterTableAddCheckConstraint(String tableName, String checkConstraintName, String checkConstraint)
Description copied from class:PlatformDdl
Alter table adding the check constraint.- Overrides:
alterTableAddCheckConstraint
in classPlatformDdl
-
alterTableDropConstraint
public String alterTableDropConstraint(String tableName, String constraintName)
Description copied from class:PlatformDdl
Drop a unique constraint from the table.- Overrides:
alterTableDropConstraint
in classPlatformDdl
-
alterColumnType
public String alterColumnType(String tableName, String columnName, String type)
Description copied from class:PlatformDdl
Alter a column type.Note that that MySql and SQL Server instead use alterColumnBaseAttributes()
- Overrides:
alterColumnType
in classPlatformDdl
-
alterColumnNotnull
public String alterColumnNotnull(String tableName, String columnName, boolean notnull)
Description copied from class:PlatformDdl
Alter a column adding or removing the not null constraint.Note that that MySql, SQL Server, and HANA instead use alterColumnBaseAttributes()
- Overrides:
alterColumnNotnull
in classPlatformDdl
-
alterColumnDefaultValue
public String alterColumnDefaultValue(String tableName, String columnName, String defaultValue)
Description copied from class:PlatformDdl
Alter column setting the default value.- Overrides:
alterColumnDefaultValue
in classPlatformDdl
-
alterColumnBaseAttributes
public String alterColumnBaseAttributes(AlterColumn alter)
Description copied from class:PlatformDdl
Alter 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:
alterColumnBaseAttributes
in classPlatformDdl
-
inlineTableComment
public void inlineTableComment(DdlBuffer apply, String tableComment) throws IOException
Description copied from class:PlatformDdl
Add an inline table comment to the create table statement.- Overrides:
inlineTableComment
in 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:
addTableComment
in classPlatformDdl
- Throws:
IOException
-
addColumnComment
public void addColumnComment(DdlBuffer apply, String table, String column, String comment)
Description copied from class:PlatformDdl
Add column comment as a separate statement.- Overrides:
addColumnComment
in classPlatformDdl
-
lockTables
public void lockTables(DdlBuffer buffer, Collection<String> tables) throws IOException
Locks all tables for triggers that have to be updated.- Overrides:
lockTables
in 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:
unlockTables
in classPlatformDdl
- Throws:
IOException
-
-