- java.lang.Object
-
- migratedb.core.internal.database.base.BaseSchema<D,T>
-
- All Implemented Interfaces:
Schema<D,T>
- Direct Known Subclasses:
BigQuerySchema,CockroachDBSchema,DB2Schema,DerbySchema,FirebirdSchema,H2Schema,HSQLDBSchema,IgniteThinSchema,InformixSchema,MySQLSchema,OracleSchema,PostgreSQLSchema,RedshiftSchema,SAPHANASchema,SnowflakeSchema,SpannerSchema,SQLiteSchema,SQLServerSchema,SybaseASESchema
public abstract class BaseSchema<D extends Database<?>,T extends Table<?,?>> extends Object implements Schema<D,T>
-
-
Field Summary
Fields Modifier and Type Field Description protected Ddatabaseprotected JdbcTemplatejdbcTemplateprotected Stringname
-
Constructor Summary
Constructors Constructor Description BaseSchema(JdbcTemplate jdbcTemplate, D database, String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Function<?,?>[]allFunctions()Retrieves all the functions in this schema.T[]allTables()Retrieves all the tables in this schema.protected Type<?,?>[]allTypes()Retrieves all the types in this schema.voidclean()Cleans all the objects in this schema.voidcreate()Creates this schema in the database.protected Function<?,?>[]doAllFunctions()Retrieves all the functions in this schema.protected abstract T[]doAllTables()Retrieves all the tables in this schema.protected abstract voiddoClean()Cleans all the objects in this schema.protected abstract voiddoCreate()Creates this schema in the database.protected abstract voiddoDrop()Drops this schema from the database.protected abstract booleandoEmpty()Checks whether this schema is empty.protected abstract booleandoExists()Checks whether this schema exists.voiddrop()Drops this schema from the database.booleanempty()booleanequals(Object o)booleanexists()Function<?,?>getFunction(String functionName, String... args)Retrieves the function with this name in this schema.StringgetName()protected Type<?,?>getType(String typeName)Retrieves the type with this name in this schema.inthashCode()StringtoString()
-
-
-
Field Detail
-
jdbcTemplate
protected final JdbcTemplate jdbcTemplate
-
name
protected final String name
-
-
Constructor Detail
-
BaseSchema
public BaseSchema(JdbcTemplate jdbcTemplate, D database, String name)
- Parameters:
jdbcTemplate- The Jdbc Template for communicating with the DB.database- The database-specific support.name- The name of the schema.
-
-
Method Detail
-
getName
public String getName()
-
exists
public boolean exists()
-
doExists
protected abstract boolean doExists() throws SQLExceptionChecks whether this schema exists.- Throws:
SQLException- when the check failed.
-
empty
public boolean empty()
-
doEmpty
protected abstract boolean doEmpty() throws SQLExceptionChecks whether this schema is empty.- Throws:
SQLException- when the check failed.
-
create
public void create()
Description copied from interface:SchemaCreates this schema in the database.
-
doCreate
protected abstract void doCreate() throws SQLExceptionCreates this schema in the database.- Throws:
SQLException- when the creation failed.
-
drop
public void drop()
Description copied from interface:SchemaDrops this schema from the database.
-
doDrop
protected abstract void doDrop() throws SQLExceptionDrops this schema from the database.- Throws:
SQLException- when the drop failed.
-
clean
public void clean()
Description copied from interface:SchemaCleans all the objects in this schema.
-
doClean
protected abstract void doClean() throws SQLExceptionCleans all the objects in this schema.- Throws:
SQLException- when the clean failed.
-
allTables
public T[] allTables()
Description copied from interface:SchemaRetrieves all the tables in this schema.
-
doAllTables
protected abstract T[] doAllTables() throws SQLException
Retrieves all the tables in this schema.- Throws:
SQLException- when the retrieval failed.
-
allTypes
protected final Type<?,?>[] allTypes()
Retrieves all the types in this schema.
-
getType
protected Type<?,?> getType(String typeName)
Retrieves the type with this name in this schema.
-
getFunction
public Function<?,?> getFunction(String functionName, String... args)
Description copied from interface:SchemaRetrieves the function with this name in this schema.
-
allFunctions
protected final Function<?,?>[] allFunctions()
Retrieves all the functions in this schema.
-
doAllFunctions
protected Function<?,?>[] doAllFunctions() throws SQLException
Retrieves all the functions in this schema.- Throws:
SQLException- when the retrieval failed.
-
toString
public String toString()
-
-