- java.lang.Object
-
- org.tentackle.model.migrate.ForeignKeyMigrator
-
public class ForeignKeyMigrator extends Object
Handles the migration of foreign keys.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description ForeignKeyMigrator(Backend backend, ForeignKey foreignKey, ForeignKeyMetaData foreignKeyMetaData)Creates a migrator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BackendgetBackend()Gets the backend.ForeignKeygetForeignKey()Gets the foreign key to migrate.ForeignKeyMetaDatagetForeignKeyMetaData()Gets the foreign key metadata.Stringmigrate()Migrates the foreign key.
-
-
-
Constructor Detail
-
ForeignKeyMigrator
public ForeignKeyMigrator(Backend backend, ForeignKey foreignKey, ForeignKeyMetaData foreignKeyMetaData)
Creates a migrator.- Parameters:
backend- the backendforeignKey- the foreign key to migrate, null if no such fk in modelforeignKeyMetaData- the foreign key meta data, null if key does not exist
-
-
Method Detail
-
getBackend
public Backend getBackend()
Gets the backend.- Returns:
- the backend
-
getForeignKey
public ForeignKey getForeignKey()
Gets the foreign key to migrate.- Returns:
- the foreign key, null if no such fk in model
-
getForeignKeyMetaData
public ForeignKeyMetaData getForeignKeyMetaData()
Gets the foreign key metadata.- Returns:
- the meta date, null if no such fk in database
-
migrate
public String migrate() throws ModelException
Migrates the foreign key.- Returns:
- the SQL code, empty string if nothing to migrate
- Throws:
ModelException- if migration failed
-
-