java.lang.Object
org.tentackle.model.migrate.TableMigrator
Handles the migration of tables.
- Author:
- harald
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordMigration result.
Contains the migration parameters and the resulting SQL code. -
Constructor Summary
ConstructorsConstructorDescriptionTableMigrator(Entity entity, Collection<ForeignKey> foreignKeys, Backend backend, TableMetaData table) Creates a table migrator. -
Method Summary
Modifier and TypeMethodDescriptionGets the backend.Gets the model's entity.getTable()Gets the database's table meta data.migrate(Collection<Pattern> hints, Collection<ColumnMigration> columnMigrations, Map<String, String> renameColumns) Create SQL code to migrate the table.toString()
-
Constructor Details
-
TableMigrator
public TableMigrator(Entity entity, Collection<ForeignKey> foreignKeys, Backend backend, TableMetaData table) Creates a table migrator.- Parameters:
entity- the model's entityforeignKeys- the foreign keys related to given entitybackend- the backendtable- the database's table meta data
-
-
Method Details
-
getBackend
Gets the backend.- Returns:
- the backend
-
getEntity
Gets the model's entity.- Returns:
- the model's entity
-
getTable
Gets the database's table meta data.- Returns:
- the database's table meta data
-
toString
-
migrate
public TableMigrator.Result migrate(Collection<Pattern> hints, Collection<ColumnMigration> columnMigrations, Map<String, String> renameColumns) throws ModelExceptionCreate SQL code to migrate the table.- Parameters:
hints- hints to control the created output, null or empty if nonecolumnMigrations- explicit column migrations, null or empty if nonerenameColumns- explicit column rename hints, null or empty if none- Returns:
- the migration result
- Throws:
ModelException- if migration failed
-