Class SqlSchemaUtils

java.lang.Object
io.micronaut.data.model.query.builder.sql.SqlSchemaUtils

@Internal public final class SqlSchemaUtils extends Object
Utility class providing methods for working with SQL schema definitions.
Since:
4.13.0
Author:
radovanradic
  • Field Details

  • Method Details

    • getSqlTableMappings

      public static List<SqlTableMapping> getSqlTableMappings(PersistentEntity entity, Dialect dialect)
      Returns SQL table mappings for an entity using no external definition providers.

      This convenience overload is intended for callers that don't need custom column/index DDL provider extensions.

      Parameters:
      entity - The entity
      dialect - The SQL dialect used to render vendor-specific definitions
      Returns:
      The SQL table definitions for the given entity
      Since:
      5.0.0
    • getSqlTableMappings

      public static List<SqlTableMapping> getSqlTableMappings(List<DefinitionProvider> definitionProviders, PersistentEntity entity, Dialect dialect)
      Returns list of SqlTableMapping for persistent entity. It will contain main entity table and potentially joined tables.
      Parameters:
      definitionProviders - the list of DefinitionProvider (column/index DDL providers)
      entity - The entity
      dialect - The SQL dialect used to render vendor-specific definitions.
      Returns:
      The SQL table definitions for the given entity
      Since:
      5.0.0
    • validateTableDistribution

      public static void validateTableDistribution(PersistentEntity entity, @Nullable PersistentEntity parent)
      Validates the Sharded and Duplicated annotations of an entity.
      Parameters:
      entity - The entity
      parent - The entity named by Sharded.parent(), if any
      Throws:
      MappingException - if the annotations cannot generate a valid table
      Since:
      5.3
    • orderForDrop

      public static PersistentEntity[] orderForDrop(PersistentEntity[] entities)
      Orders entities for dropping their tables, with the child tables of a table family before its root tables.
      Parameters:
      entities - The entities
      Returns:
      The entities in the order to drop their tables
      Since:
      5.3