Class SqlServerDdl
- java.lang.Object
-
- io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl
-
- io.ebeaninternal.dbmigration.ddlgeneration.platform.SqlServerDdl
-
public class SqlServerDdl extends PlatformDdl
MS SQL Server platform specific DDL.
-
-
Constructor Summary
Constructors Constructor Description SqlServerDdl(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.StringalterTableAddUniqueConstraint(String tableName, String uqName, String[] columns, String[] nullableColumns)MsSqlServer specific null handling on unique constraints.voidalterTableDropColumn(DdlBuffer buffer, String tableName, String columnName)It is rather complex to delete a column on SqlServer as there must not exist any references (constraints, default values, indices and foreign keys).StringalterTableDropConstraint(String tableName, String constraintName)Drop a unique constraint from the table.StringalterTableDropForeignKey(String tableName, String fkName)Return the drop foreign key clause.StringalterTableDropUniqueConstraint(String tableName, String uniqueConstraintName)Drop a unique constraint from the table (Sometimes this is an index).StringcreateSequence(String sequenceName, DdlIdentity identity)Generate and return the create sequence DDL.StringdropIndex(String indexName, String tableName, boolean concurrent)Return the drop index statement.StringdropSequence(String sequenceName)Return the drop sequence statement (potentially with if exists clause).StringdropTable(String tableName)Return the drop table statement (potentially with if exists clause).voidgenerateProlog(DdlWrite write)This writes the multi value datatypes needed for MultiValueBind.-
Methods inherited from class io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl
addHistoryTable, addTablePartition, alterTableAddCheckConstraint, alterTableAddColumn, alterTableAddForeignKey, asIdentityColumn, configure, convert, convertDefaultValue, createCheckConstraint, createDdlHandler, createIndex, createWithHistory, dropHistoryTable, dropIndex, generateEpilog, getCreateTableCommandPrefix, getPlatform, getUpdateNullWithDefault, inlineTableComment, isIncludeStorageEngine, isInlineComments, isInlineForeignKeys, isInlineUniqueWhenNullable, lockTables, regenerateHistoryTriggers, setLockTimeout, suppressPrimaryKeyOnPartition, tableInlineForeignKey, tableStorageEngine, unlockTables, useIdentityType, writeTableColumns
-
-
-
-
Constructor Detail
-
SqlServerDdl
public SqlServerDdl(io.ebean.config.dbplatform.DatabasePlatform platform)
-
-
Method Detail
-
dropTable
public String dropTable(String tableName)
Description copied from class:PlatformDdlReturn the drop table statement (potentially with if exists clause).- Overrides:
dropTablein classPlatformDdl
-
alterTableDropForeignKey
public String alterTableDropForeignKey(String tableName, String fkName)
Description copied from class:PlatformDdlReturn the drop foreign key clause.- Overrides:
alterTableDropForeignKeyin classPlatformDdl
-
dropSequence
public String dropSequence(String sequenceName)
Description copied from class:PlatformDdlReturn the drop sequence statement (potentially with if exists clause).- Overrides:
dropSequencein classPlatformDdl
-
dropIndex
public String dropIndex(String indexName, String tableName, boolean concurrent)
Description copied from class:PlatformDdlReturn the drop index statement.- Overrides:
dropIndexin classPlatformDdl
-
alterTableAddUniqueConstraint
public String alterTableAddUniqueConstraint(String tableName, String uqName, String[] columns, String[] nullableColumns)
MsSqlServer specific null handling on unique constraints.- Overrides:
alterTableAddUniqueConstraintin classPlatformDdl
-
alterTableDropConstraint
public String alterTableDropConstraint(String tableName, String constraintName)
Description copied from class:PlatformDdlDrop a unique constraint from the table.- Overrides:
alterTableDropConstraintin classPlatformDdl
-
alterTableDropUniqueConstraint
public String alterTableDropUniqueConstraint(String tableName, String uniqueConstraintName)
Drop a unique constraint from the table (Sometimes this is an index).- Overrides:
alterTableDropUniqueConstraintin classPlatformDdl
-
createSequence
public String createSequence(String sequenceName, DdlIdentity identity)
Generate and return the create sequence DDL.- Overrides:
createSequencein 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
-
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
-
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) throws IOException
Add column comment as a separate statement.- Overrides:
addColumnCommentin classPlatformDdl- Throws:
IOException
-
alterTableDropColumn
public void alterTableDropColumn(DdlBuffer buffer, String tableName, String columnName) throws IOException
It is rather complex to delete a column on SqlServer as there must not exist any references (constraints, default values, indices and foreign keys). That's why we call a user stored procedure here- Overrides:
alterTableDropColumnin classPlatformDdl- Throws:
IOException
-
generateProlog
public void generateProlog(DdlWrite write) throws IOException
This writes the multi value datatypes needed for MultiValueBind.- Overrides:
generatePrologin classPlatformDdl- Throws:
IOException
-
-