- java.lang.Object
-
- org.tentackle.model.migrate.TableMigrator
-
public class TableMigrator extends Object
Handles the migration of tables.- Author:
- harald
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTableMigrator.ResultMigration result.
-
Constructor Summary
Constructors Constructor Description TableMigrator(Entity entity, Collection<ForeignKey> foreignKeys, Backend backend, TableMetaData table)Creates a table migrator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BackendgetBackend()Gets the backend.EntitygetEntity()Gets the model's entity.TableMetaDatagetTable()Gets the database's table meta data.TableMigrator.Resultmigrate(Collection<Pattern> hints, Collection<ColumnMigration> columnMigrations, Map<String,String> renameColumns)Create SQL code to migrate the table.StringtoString()
-
-
-
Constructor Detail
-
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 Detail
-
getBackend
public Backend getBackend()
Gets the backend.- Returns:
- the backend
-
getEntity
public Entity getEntity()
Gets the model's entity.- Returns:
- the model's entity
-
getTable
public TableMetaData getTable()
Gets the database's table meta data.- Returns:
- the database's table meta data
-
migrate
public TableMigrator.Result migrate(Collection<Pattern> hints, Collection<ColumnMigration> columnMigrations, Map<String,String> renameColumns) throws ModelException
Create SQL code to migrate the table.- Parameters:
hints- hints to control the created outputcolumnMigrations- explicit column migrations, null if nonerenameColumns- explict column rename hints, null if none- Returns:
- the migration result
- Throws:
ModelException- if migration failed
-
-