Class TableMigrator

java.lang.Object
org.tentackle.model.migrate.TableMigrator

public class TableMigrator extends Object
Handles the migration of tables.
Author:
harald
  • Constructor Details

    • TableMigrator

      public TableMigrator(Entity entity, Collection<ForeignKey> foreignKeys, Backend backend, TableMetaData table)
      Creates a table migrator.
      Parameters:
      entity - the model's entity
      foreignKeys - the foreign keys related to given entity
      backend - the backend
      table - the database's table meta data
  • Method Details

    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 output
      columnMigrations - explicit column migrations, null if none
      renameColumns - explict column rename hints, null if none
      Returns:
      the migration result
      Throws:
      ModelException - if migration failed