Class ForeignKeyMigrator


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

      Constructors 
      Constructor Description
      ForeignKeyMigrator​(org.tentackle.sql.Backend backend, ForeignKey foreignKey, org.tentackle.sql.metadata.ForeignKeyMetaData foreignKeyMetaData)
      Creates a migrator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.tentackle.sql.Backend getBackend()
      Gets the backend.
      ForeignKey getForeignKey()
      Gets the foreign key to migrate.
      org.tentackle.sql.metadata.ForeignKeyMetaData getForeignKeyMetaData()
      Gets the foreign key metadata.
      java.lang.String migrate()
      Migrates the foreign key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ForeignKeyMigrator

        public ForeignKeyMigrator​(org.tentackle.sql.Backend backend,
                                  ForeignKey foreignKey,
                                  org.tentackle.sql.metadata.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 org.tentackle.sql.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 org.tentackle.sql.metadata.ForeignKeyMetaData getForeignKeyMetaData()
        Gets the foreign key metadata.
        Returns:
        the meta date, null if no such fk in database
      • migrate

        public java.lang.String migrate()
                                 throws ModelException
        Migrates the foreign key.
        Returns:
        the SQL code, empty string if nothing to migrate
        Throws:
        ModelException - if migration failed