Interface DatabaseMetaDataReader

All Known Implementing Classes:
DatabaseMetaDataReaderImpl

public interface DatabaseMetaDataReader
  • Method Details

    • isTablePresent

      boolean isTablePresent(DatabaseMetaData databaseMetaData, Class<? extends RawEntity<?>> type)
      Checks if the table corresponding to given type exists in the database.
      Parameters:
      databaseMetaData - of the database to be checked
      type - to check against
      Returns:
      true if the table exists, false otherwise
    • getTableNames

      Iterable<String> getTableNames(DatabaseMetaData databaseMetaData)
      Gets the names of the existing tables in the DB
      Parameters:
      databaseMetaData - the meta data from which to extract the table names
      Returns:
      an Iterable of table names as strings
    • getFields

      Iterable<? extends Field> getFields(DatabaseMetaData databaseMetaData, String tableName)
      Parameters:
      databaseMetaData -
      tableName -
      Returns:
    • getForeignKeys

      Iterable<? extends ForeignKey> getForeignKeys(DatabaseMetaData databaseMetaData, String tableName)
      Gets the list of foreign keys for a given table
      Parameters:
      databaseMetaData - the database metadata to read the information from
      tableName - the name of the table from which to read the foreign keys
      Returns:
      an Iterable of foreign keys
    • getIndexes

      Iterable<? extends Index> getIndexes(DatabaseMetaData databaseMetaData, String tableName)
      Gets the list of simple indexes for a given table. AO only supports single column indexes, and as such composite indexes will not be returned by this method even if they exist in the table. Prior to AO v1.1.4 this method returned fragments of composite indexes and it was then possible for the migration code to crash because it would try to delete the same index multiple times.
      Parameters:
      databaseMetaData - the database metadata to read the information from
      tableName - the name of the table from which to read the indexes
      Returns:
      an Iterable of simple indexes