Class ForeignKeyMigrator


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

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