- java.lang.Object
-
- org.tentackle.model.migrate.TableMigrator
-
public class TableMigrator extends java.lang.ObjectHandles 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, java.util.Collection<ForeignKey> foreignKeys, org.tentackle.sql.Backend backend, org.tentackle.sql.metadata.TableMetaData table)Creates a table migrator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.tentackle.sql.BackendgetBackend()Gets the backend.EntitygetEntity()Gets the model's entity.org.tentackle.sql.metadata.TableMetaDatagetTable()Gets the database's table meta data.TableMigrator.Resultmigrate(java.util.Collection<java.util.regex.Pattern> hints, java.util.Collection<ColumnMigration> columnMigrations)Create SQL code to migrate the table.java.lang.StringtoString()
-
-
-
Constructor Detail
-
TableMigrator
public TableMigrator(Entity entity, java.util.Collection<ForeignKey> foreignKeys, org.tentackle.sql.Backend backend, org.tentackle.sql.metadata.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 org.tentackle.sql.Backend getBackend()
Gets the backend.- Returns:
- the backend
-
getEntity
public Entity getEntity()
Gets the model's entity.- Returns:
- the model's entity
-
getTable
public org.tentackle.sql.metadata.TableMetaData getTable()
Gets the database's table meta data.- Returns:
- the database's table meta data
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
migrate
public TableMigrator.Result migrate(java.util.Collection<java.util.regex.Pattern> hints, java.util.Collection<ColumnMigration> columnMigrations) throws ModelException
Create SQL code to migrate the table.- Parameters:
hints- hints to control the created outputcolumnMigrations- explicit column migrations, null if none- Returns:
- the migration result
- Throws:
ModelException- if migration failed
-
-