Class ForeignKeyMigrator

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

public class ForeignKeyMigrator extends Object
Handles the migration of foreign keys.
Author:
harald
  • Constructor Details

    • ForeignKeyMigrator

      public ForeignKeyMigrator(Backend backend, ForeignKey foreignKey, ForeignKeyMetaData foreignKeyMetaData)
      Creates a migrator.
      Parameters:
      backend - the backend
      foreignKey - the foreign key to migrate, null if no such fk in model
      foreignKeyMetaData - the foreign key metadata, null if key does not exist
  • Method Details

    • 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