Class ColumnMigrator


  • public class ColumnMigrator
    extends java.lang.Object
    Handles the migration of columns.
    Author:
    harald
    • Constructor Summary

      Constructors 
      Constructor Description
      ColumnMigrator​(Entity entity, Attribute attribute, org.tentackle.sql.Backend backend, java.util.Collection<org.tentackle.sql.metadata.ColumnMetaData> columns)
      Creates a column migrator.
      ColumnMigrator​(Entity entity, Attribute attribute, org.tentackle.sql.Backend backend, org.tentackle.sql.metadata.ColumnMetaData... columns)
      Creates a column migrator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Attribute getAttribute()
      Gets the model's attribute.
      org.tentackle.sql.Backend getBackend()
      Gets the backend.
      org.tentackle.sql.metadata.ColumnMetaData[] getColumns()
      Gets the database's column meta data.
      java.lang.String migrate()
      Migrates the column.
      • Methods inherited from class java.lang.Object

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

      • ColumnMigrator

        public ColumnMigrator​(Entity entity,
                              Attribute attribute,
                              org.tentackle.sql.Backend backend,
                              org.tentackle.sql.metadata.ColumnMetaData... columns)
        Creates a column migrator.
        Parameters:
        entity - the migrated entity
        attribute - the model's attribute, null if drop columns
        backend - the backend
        columns - the database's column(s), null if add attribute
      • ColumnMigrator

        public ColumnMigrator​(Entity entity,
                              Attribute attribute,
                              org.tentackle.sql.Backend backend,
                              java.util.Collection<org.tentackle.sql.metadata.ColumnMetaData> columns)
        Creates a column migrator.
        Parameters:
        entity - the migrated entity
        attribute - the model's attribute, null if drop columns
        backend - the backend
        columns - the database's column(s), null or empty if add attribute
    • Method Detail

      • getBackend

        public org.tentackle.sql.Backend getBackend()
        Gets the backend.
        Returns:
        the backend
      • getAttribute

        public Attribute getAttribute()
        Gets the model's attribute.
        Returns:
        the model's attribute
      • getColumns

        public org.tentackle.sql.metadata.ColumnMetaData[] getColumns()
        Gets the database's column meta data.
        Returns:
        the database's column(s)
      • migrate

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