Class BaseSchema<D extends Database<?>,T extends Table<?,?>>

java.lang.Object
migratedb.v1.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 Details

    • jdbcTemplate

      protected final JdbcTemplate jdbcTemplate
    • database

      protected final D extends Database<?> database
    • name

      protected final String name
  • Constructor Details

    • 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 Details

    • getName

      public String getName()
      Specified by:
      getName in interface Schema<D extends Database<?>,T extends Table<?,?>>
    • exists

      public boolean exists()
      Specified by:
      exists in interface Schema<D extends Database<?>,T extends Table<?,?>>
    • doExists

      protected abstract boolean doExists() throws SQLException
      Checks whether this schema exists.
      Throws:
      SQLException - when the check failed.
    • empty

      public boolean empty()
      Specified by:
      empty in interface Schema<D extends Database<?>,T extends Table<?,?>>
    • doEmpty

      protected abstract boolean doEmpty() throws SQLException
      Checks whether this schema is empty.
      Throws:
      SQLException - when the check failed.
    • create

      public void create()
      Description copied from interface: Schema
      Creates this schema in the database.
      Specified by:
      create in interface Schema<D extends Database<?>,T extends Table<?,?>>
    • doCreate

      protected abstract void doCreate() throws SQLException
      Creates this schema in the database.
      Throws:
      SQLException - when the creation failed.
    • drop

      public void drop()
      Description copied from interface: Schema
      Drops this schema from the database.
      Specified by:
      drop in interface Schema<D extends Database<?>,T extends Table<?,?>>
    • doDrop

      protected abstract void doDrop() throws SQLException
      Drops this schema from the database.
      Throws:
      SQLException - when the drop failed.
    • clean

      public void clean()
      Description copied from interface: Schema
      Cleans all the objects in this schema.
      Specified by:
      clean in interface Schema<D extends Database<?>,T extends Table<?,?>>
    • doClean

      protected abstract void doClean() throws SQLException
      Cleans all the objects in this schema.
      Throws:
      SQLException - when the clean failed.
    • allTables

      public T[] allTables()
      Description copied from interface: Schema
      Retrieves all the tables in this schema.
      Specified by:
      allTables in interface Schema<D extends Database<?>,T extends Table<?,?>>
    • 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: Schema
      Retrieves the function with this name in this schema.
      Specified by:
      getFunction in interface Schema<D extends Database<?>,T extends Table<?,?>>
    • 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()
      Overrides:
      toString in class Object
      Returns:
      The quoted name of this schema.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object