Class SQLServerSchema
- java.lang.Object
-
- migratedb.core.internal.database.base.BaseSchema<SQLServerDatabase,SQLServerTable>
-
- migratedb.core.internal.database.sqlserver.SQLServerSchema
-
- All Implemented Interfaces:
Schema<SQLServerDatabase,SQLServerTable>
- Direct Known Subclasses:
SynapseSchema
public class SQLServerSchema extends BaseSchema<SQLServerDatabase,SQLServerTable>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSQLServerSchema.DBObjectSQL Server object meta-data.protected static classSQLServerSchema.ObjectTypeSQL Server object types for which we support automatic clean-up.
-
Field Summary
Fields Modifier and Type Field Description protected StringdatabaseName-
Fields inherited from class migratedb.core.internal.database.base.BaseSchema
database, jdbcTemplate, name
-
-
Constructor Summary
Constructors Constructor Description SQLServerSchema(JdbcTemplate jdbcTemplate, SQLServerDatabase database, String databaseName, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<String>cleanObjects(String dropQualifier, SQLServerSchema.ObjectType... objectTypes)protected List<String>cleanRules()protected List<String>cleanSynonyms()protected List<String>cleanTriggers()protected SQLServerTable[]doAllTables()Retrieves all the tables in this schema.protected voiddoClean()Cleans all the objects in this schema.protected voiddoCreate()Creates this schema in the database.protected voiddoDrop()Drops this schema from the database.protected booleandoEmpty()Checks whether this schema is empty.protected booleandoExists()Checks whether this schema exists.Table<?,?>getTable(String tableName)Retrieves the table with this name in this schema.protected List<SQLServerSchema.DBObject>queryDBObjects(SQLServerSchema.ObjectType... types)Query objects with any of the given types.-
Methods inherited from class migratedb.core.internal.database.base.BaseSchema
allFunctions, allTables, allTypes, clean, create, doAllFunctions, drop, empty, equals, exists, getFunction, getName, getType, hashCode, toString
-
-
-
-
Field Detail
-
databaseName
protected final String databaseName
-
-
Constructor Detail
-
SQLServerSchema
public SQLServerSchema(JdbcTemplate jdbcTemplate, SQLServerDatabase database, String databaseName, String name)
-
-
Method Detail
-
doExists
protected boolean doExists() throws SQLExceptionDescription copied from class:BaseSchemaChecks whether this schema exists.- Specified by:
doExistsin classBaseSchema<SQLServerDatabase,SQLServerTable>- Throws:
SQLException- when the check failed.
-
doEmpty
protected boolean doEmpty() throws SQLExceptionDescription copied from class:BaseSchemaChecks whether this schema is empty.- Specified by:
doEmptyin classBaseSchema<SQLServerDatabase,SQLServerTable>- Throws:
SQLException- when the check failed.
-
doCreate
protected void doCreate() throws SQLExceptionDescription copied from class:BaseSchemaCreates this schema in the database.- Specified by:
doCreatein classBaseSchema<SQLServerDatabase,SQLServerTable>- Throws:
SQLException- when the creation failed.
-
doDrop
protected void doDrop() throws SQLExceptionDescription copied from class:BaseSchemaDrops this schema from the database.- Specified by:
doDropin classBaseSchema<SQLServerDatabase,SQLServerTable>- Throws:
SQLException- when the drop failed.
-
doClean
protected void doClean() throws SQLExceptionDescription copied from class:BaseSchemaCleans all the objects in this schema.- Specified by:
doCleanin classBaseSchema<SQLServerDatabase,SQLServerTable>- Throws:
SQLException- when the clean failed.
-
queryDBObjects
protected List<SQLServerSchema.DBObject> queryDBObjects(SQLServerSchema.ObjectType... types) throws SQLException
Query objects with any of the given types.- Parameters:
types- The object types to be queried.- Returns:
- The found objects.
- Throws:
SQLException- when the retrieval failed.
-
cleanTriggers
protected List<String> cleanTriggers() throws SQLException
- Returns:
- The drop statements.
- Throws:
SQLException- when the clean statements could not be generated.
-
cleanSynonyms
protected List<String> cleanSynonyms() throws SQLException
- Returns:
- The drop statements.
- Throws:
SQLException- when the clean statements could not be generated.
-
cleanRules
protected List<String> cleanRules() throws SQLException
- Returns:
- The drop statements.
- Throws:
SQLException- when the clean statements could not be generated.
-
cleanObjects
protected List<String> cleanObjects(String dropQualifier, SQLServerSchema.ObjectType... objectTypes) throws SQLException
- Parameters:
dropQualifier- The type of DROP statement to issue.objectTypes- The type of objects to drop.- Returns:
- The drop statements.
- Throws:
SQLException- when the clean statements could not be generated.
-
doAllTables
protected SQLServerTable[] doAllTables() throws SQLException
Description copied from class:BaseSchemaRetrieves all the tables in this schema.- Specified by:
doAllTablesin classBaseSchema<SQLServerDatabase,SQLServerTable>- Throws:
SQLException- when the retrieval failed.
-
-