Project Wonder 5.0.0.8794

er.extensions.migration
Class ERXMigrationTable

java.lang.Object
  extended by er.extensions.migration.ERXMigrationTable

public class ERXMigrationTable
extends Object

ERXMigrationTable provides table-level migration API's. To obtain a table, you should call ERXMigrationDatabase.existingTableNamed or ERXMigrationDatabase.newTableNamed. Note: The .newXxxColumn API's cannot reference prototypes for the same reason that migrations in general cannot reference EOModels.

Author:
mschrag

Constructor Summary
protected ERXMigrationTable(ERXMigrationDatabase database, String name)
          Constructs an ERXMigrationTable.
 
Method Summary
 NSArray<EOSQLExpression> _addForeignKeyExpressions(ERXMigrationColumn sourceColumn, ERXMigrationColumn destinationColumn)
          Returns an array of EOSQLExpressions for adding a foreign key constraint to this table (only supports single attribute FK's right now).
 EOEntity _blankEntity()
          Returns an EOEntity representing this table with no EOAttributes in it.
 void _columnDeleted(ERXMigrationColumn column)
          Callback method for ERXMigrationColumn to notify the table that it has been deleted.
 NSArray<EOSQLExpression> _createExpressions()
          Returns an array of EOSQLExpressions for creating this table and all of its ERXMigrationColumns.
 NSArray<EOSQLExpression> _dropExpressions()
          Returns an array of EOSQLExpressions for dropping this table.
 NSArray<EOSQLExpression> _dropPrimaryKeyExpressions(ERXMigrationColumn... columns)
          Returns an array of EOSQLExpressions for removing the primary key constraint of this table (only supports single attribute PK's right now).
 ERXMigrationColumn _newColumn(String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, String overrideValueType, Object defaultValue, boolean autocreate)
          Returns a new ERXMigrationColumn with the given attributes.
 EOEntity _newEntity()
          Returns an EOEntity representing this table that contains all of the EOAttributes for any ERXMigrationColumn that has been created or retrieved from this table.
 EORelationship _newRelationship(ERXMigrationColumn sourceColumn, ERXMigrationColumn destinationColumn)
          Returns a simple single-attribute-mapping EORelationship between two columns.
 NSArray<EOSQLExpression> _renameToExpressions(String newName)
          Returns an array of EOSQLExpressions for renaming this table.
 void _setName(String name)
          Sets the name of this table.
 void _setNew(boolean isNew)
          Sets whether or not this table has been created in the database.
 NSArray<EOSQLExpression> _setPrimaryKeyExpressions(ERXMigrationColumn... columns)
          Returns an array of EOSQLExpressions for setting the primary key constraint of this table
 void addForeignKey(boolean create, ERXMigrationColumn sourceColumn, ERXMigrationColumn destinationColumn)
          Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).
 void addForeignKey(ERXMigrationColumn sourceColumn, ERXMigrationColumn destinationColumn)
          Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).
 void addForeignKey(String sourceColumnName, ERXMigrationColumn destinationColumn)
          Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).
 void addForeignKey(String sourceColumnName, String destinationTableName, String destinationColumnName)
          Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).
 void addIndex(boolean create, ERXMigrationIndex index)
          Executes the SQL operations to add an index.
 void addIndex(boolean create, String indexName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Executes the SQL operations to add an index.
 void addIndex(ERXMigrationIndex index)
          Executes the SQL operations to add an index.
 void addIndex(String columnName)
          Executes the SQL operations to add this index.
 void addIndex(String indexName, ERXMigrationColumn... columns)
          Executes the SQL operations to add an index.
 void addIndex(String indexName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Executes the SQL operations to add an index.
 void addIndex(String indexName, String columnName)
          Executes the SQL operations to add this index.
 void addIndex(String indexName, String columnName, int width)
          Executes the SQL operations to add this index.
 void addUniqueIndex(boolean create, String indexName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Executes the SQL operations to add a unique index.
 void addUniqueIndex(String columnName)
          Executes the SQL operations to add this unique index.
 void addUniqueIndex(String indexName, ERXMigrationColumn... columns)
          Executes the SQL operations to add a unique index.
 void addUniqueIndex(String indexName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Executes the SQL operations to add a unique index.
 void addUniqueIndex(String indexName, String columnName)
          Executes the SQL operations to add this unique index.
 void addUniqueIndex(String indexName, String columnName, int width)
          Executes the SQL operations to add this unique index.
 void create()
          Executes the SQL operations to create this table.
 ERXMigrationDatabase database()
          Returns the ERXMigrationDatabase parent of this table.
 void drop()
          Executes the SQL operations to drop this table.
 void dropPrimaryKey(ERXMigrationColumn... columns)
          Executes the SQL operations to drop this primary key constraint (only supports single attribute PK's right now).
 ERXMigrationColumn existingColumnNamed(String name)
          Returns the ERMigrationColumn for the column with the given name.
 boolean isNew()
          Returns true if this table has not yet been created in the database.
 NSArray<String> languages()
          Returns the configured default languages for this migration.
 String name()
          Returns the name of this table.
 ERXMigrationColumn newBigDecimalColumn(String name, int precision, int scale, boolean allowsNull)
          Returns a new BigDecimal column.
 ERXMigrationColumn newBigDecimalColumn(String name, int precision, int scale, boolean allowsNull, BigDecimal defaultValue)
          Returns a new BigDecimal column.
 ERXMigrationColumn newBigIntegerColumn(String name, boolean allowsNull)
          Returns a new long column.
 ERXMigrationColumn newBigIntegerColumn(String name, boolean allowsNull, Long defaultValue)
          Returns a new long column.
 ERXMigrationColumn newBlobColumn(String name, boolean allowsNull)
          Returns a new Blob column.
 ERXMigrationColumn newBlobColumn(String name, int width, boolean allowsNull)
          Returns a new Blob column.
 ERXMigrationColumn newBlobColumn(String name, int width, boolean allowsNull, NSData defaultValue)
          Returns a new Blob column.
 ERXMigrationColumn newBooleanColumn(String name, boolean allowsNull)
          Returns a new varchar(5) boolean column.
 ERXMigrationColumn newBooleanColumn(String name, boolean allowsNull, Boolean defaultValue)
          Returns a new varchar(5) boolean column.
 ERXMigrationColumn newClobColumn(String name, boolean allowsNull)
          Returns a new string blob column.
 ERXMigrationColumn newColumn(String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, String overrideValueType)
          Returns a new ERXMigrationColumn with the given attributes.
 ERXMigrationColumn newColumn(String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, String overrideValueType, Object defaultValue)
          Returns a new ERXMigrationColumn with the given attributes.
 ERXMigrationColumn newFlagBooleanColumn(String name, boolean allowsNull)
          Returns a new flag boolean column.
 ERXMigrationColumn newFloatColumn(String name, int precision, int scale, boolean allowsNull)
          Returns a new float column.
 ERXMigrationColumn newFloatColumn(String name, int precision, int scale, boolean allowsNull, Float defaultValue)
          Returns a new float column.
 ERXMigrationColumn newIntBooleanColumn(String name, boolean allowsNull)
          Returns a new integer boolean column.
 ERXMigrationColumn newIntBooleanColumn(String name, boolean allowsNull, Boolean defaultValue)
          Returns a new integer boolean column.
 ERXMigrationColumn newIntegerColumn(String name, boolean allowsNull)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(String name, boolean allowsNull, Integer defaultValue)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(String name, int scale, boolean allowsNull)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(String name, int scale, boolean allowsNull, Integer defaultValue)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(String name, int scale, int precision, boolean allowsNull)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(String name, int scale, int precision, boolean allowsNull, Object defaultValue)
          Returns a new integer column.
 ERXMigrationColumn newIpAddressColumn(String name, boolean allowsNull)
          Returns a new ipaddress column.
 ERXMigrationColumn newIpAddressColumn(String name, boolean allowsNull, String defaultValue)
          Returns a new ipaddress column.
 ERXMigrationColumn newLargeStringColumn(String name, boolean allowsNull)
          Returns a new String column (VARCHAR) that corresponds to the varcharLarge prototype.
 NSArray<ERXMigrationColumn> newLocalizedClobColumns(String name, boolean allowsNull)
          Returns a new localized string blob column.
 NSArray<ERXMigrationColumn> newLocalizedStringColumns(String name, int width, boolean allowsNull)
          Returns a new localized String column (VARCHAR).
 NSArray<ERXMigrationColumn> newLocalizedStringColumns(String name, int width, boolean allowsNull, String defaultValue)
          Returns a new localized String column (VARCHAR).
 NSDictionary<String,Object> newPrimaryKey()
          Returns a dictionary that represents the primary key for an entity described by this table.
 NSArray<NSDictionary<String,Object>> newPrimaryKeys(int count)
          Returns an array of dictionaries that represent the primary keys for an entity described by this table.
 ERXMigrationColumn newStringColumn(String name, boolean allowsNull, String defaultValue)
          Returns a new String column (VARCHAR) that corresponds to the varcharLarge prototype.
 ERXMigrationColumn newStringColumn(String name, int width, boolean allowsNull)
          Returns a new String column (VARCHAR).
 ERXMigrationColumn newStringColumn(String name, int width, boolean allowsNull, String defaultValue)
          Returns a new String column (VARCHAR).
 ERXMigrationColumn newTimestampColumn(String name, boolean allowsNull)
          Returns a new timestamp column.
 ERXMigrationColumn newTimestampColumn(String name, boolean allowsNull, NSTimestamp defaultValue)
          Returns a new timestamp column.
 void renameTo(String newName)
          Executes the SQL operations to rename this table.
 void setPrimaryKey(boolean create, ERXMigrationColumn... columns)
          Executes the SQL operations to add this primary key constraint.
 void setPrimaryKey(ERXMigrationColumn... columns)
          Executes the SQL operations to add this primary key constraint.
 void setPrimaryKey(String... columnNames)
          Executes the SQL operations to add this primary key constraint.
 void setPrimaryKey(String columnName)
          Executes the SQL operations to add this primary key constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXMigrationTable

protected ERXMigrationTable(ERXMigrationDatabase database,
                            String name)
Constructs an ERXMigrationTable.

Parameters:
database - the database this table is within
name - the name of this table
Method Detail

database

public ERXMigrationDatabase database()
Returns the ERXMigrationDatabase parent of this table.

Returns:
the ERXMigrationDatabase parent of this table

languages

public NSArray<String> languages()
Returns the configured default languages for this migration.


_setName

public void _setName(String name)
Sets the name of this table. This does not perform a table rename operation.

Parameters:
name - the name of this table

name

public String name()
Returns the name of this table.

Returns:
the name of this table

isNew

public boolean isNew()
Returns true if this table has not yet been created in the database.

Returns:
if this table has not yet been created in the database

_setNew

public void _setNew(boolean isNew)
Sets whether or not this table has been created in the database.

Parameters:
isNew - if true, the table has been created

_blankEntity

public EOEntity _blankEntity()
Returns an EOEntity representing this table with no EOAttributes in it.

Returns:
a shell of an EOEntity for this table

_newEntity

public EOEntity _newEntity()
Returns an EOEntity representing this table that contains all of the EOAttributes for any ERXMigrationColumn that has been created or retrieved from this table.

Returns:
an EOAttributeful EOEntity for this table

existingColumnNamed

public ERXMigrationColumn existingColumnNamed(String name)
Returns the ERMigrationColumn for the column with the given name. If no column has already been created via a newColumn call, then this will simply return a shell ERXMigrationColumn that should be sufficient for performing drop, rename, and other reference operations.

Parameters:
name - the name of the column to retrieve
Returns:
the ERXMigrationColumn for the column name

_newRelationship

public EORelationship _newRelationship(ERXMigrationColumn sourceColumn,
                                       ERXMigrationColumn destinationColumn)
Returns a simple single-attribute-mapping EORelationship between two columns. This is called by the foreign key generator.

Parameters:
sourceColumn - the source attribute of the relationship
destinationColumn - the destination attribute of the relationship
Returns:
the EORelationship that joins the two given columns

_newColumn

public ERXMigrationColumn _newColumn(String name,
                                     int jdbcType,
                                     int width,
                                     int precision,
                                     int scale,
                                     boolean allowsNull,
                                     String overrideValueType,
                                     Object defaultValue,
                                     boolean autocreate)
                              throws SQLException
Returns a new ERXMigrationColumn with the given attributes. This method is the most general-purpose of the .newXxx methods. Calling this method will not actually create the column, rather it will only return a metadata wrapper of the attributes you specify. Call .create() on the resulting column object to create the column (or create several columns and then call .create() on this table to create an entire table).

Parameters:
name - the name of the column to create
jdbcType - the JDBC type of the column (see java.sql.Types)
width - the width of the column (or 0 for unspecified)
precision - the precision of the column (or 0 for unspecified)
scale - the scale of the column (or 0 for unspecified)
allowsNull - if true, the column will allow null values
defaultValue - the default value for the column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newColumn

public ERXMigrationColumn newColumn(String name,
                                    int jdbcType,
                                    int width,
                                    int precision,
                                    int scale,
                                    boolean allowsNull,
                                    String overrideValueType,
                                    Object defaultValue)
                             throws SQLException
Returns a new ERXMigrationColumn with the given attributes. This method is the most general-purpose of the .newXxx methods. If this table already exists, calling the .newXxxColumn methods will immediate execute the SQL to add the columns to the table. If this table is new, however, calling .newXxxColumn will only return a metadata object, and you must call .create() on the table.

Parameters:
name - the name of the column to create
jdbcType - the JDBC type of the column (see java.sql.Types)
width - the width of the column (or 0 for unspecified)
precision - the precision of the column (or 0 for unspecified)
scale - the scale of the column (or 0 for unspecified)
allowsNull - if true, the column will allow null values
defaultValue - the default value for the column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newColumn

public ERXMigrationColumn newColumn(String name,
                                    int jdbcType,
                                    int width,
                                    int precision,
                                    int scale,
                                    boolean allowsNull,
                                    String overrideValueType)
                             throws SQLException
Returns a new ERXMigrationColumn with the given attributes. This method is the most general-purpose of the .newXxx methods. If this table already exists, calling the .newXxxColumn methods will immediate execute the SQL to add the columns to the table. If this table is new, however, calling .newXxxColumn will only return a metadata object, and you must call .create() on the table.

Parameters:
name - the name of the column to create
jdbcType - the JDBC type of the column (see java.sql.Types)
width - the width of the column (or 0 for unspecified)
precision - the precision of the column (or 0 for unspecified)
scale - the scale of the column (or 0 for unspecified)
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newStringColumn

public ERXMigrationColumn newStringColumn(String name,
                                          int width,
                                          boolean allowsNull)
                                   throws SQLException
Returns a new String column (VARCHAR). See newColumn(..) for the full docs.

Parameters:
name - the name of the column
width - the max width of the varchar
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newStringColumn

public ERXMigrationColumn newStringColumn(String name,
                                          int width,
                                          boolean allowsNull,
                                          String defaultValue)
                                   throws SQLException
Returns a new String column (VARCHAR). See newColumn(..) for the full docs.

Parameters:
name - the name of the column
width - the max width of the varchar
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newLargeStringColumn

public ERXMigrationColumn newLargeStringColumn(String name,
                                               boolean allowsNull)
                                        throws SQLException
Returns a new String column (VARCHAR) that corresponds to the varcharLarge prototype. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newStringColumn

public ERXMigrationColumn newStringColumn(String name,
                                          boolean allowsNull,
                                          String defaultValue)
                                   throws SQLException
Returns a new String column (VARCHAR) that corresponds to the varcharLarge prototype. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newLocalizedStringColumns

public NSArray<ERXMigrationColumn> newLocalizedStringColumns(String name,
                                                             int width,
                                                             boolean allowsNull)
                                                      throws SQLException
Returns a new localized String column (VARCHAR). See newColumn(..) for the full docs.

Parameters:
name - the name of the column
width - the max width of the varchar
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newLocalizedStringColumns

public NSArray<ERXMigrationColumn> newLocalizedStringColumns(String name,
                                                             int width,
                                                             boolean allowsNull,
                                                             String defaultValue)
                                                      throws SQLException
Returns a new localized String column (VARCHAR). See newColumn(..) for the full docs.

Parameters:
name - the name of the column
width - the max width of the varchar
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newLocalizedClobColumns

public NSArray<ERXMigrationColumn> newLocalizedClobColumns(String name,
                                                           boolean allowsNull)
                                                    throws SQLException
Returns a new localized string blob column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(String name,
                                           boolean allowsNull)
                                    throws SQLException
Returns a new integer column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(String name,
                                           boolean allowsNull,
                                           Integer defaultValue)
                                    throws SQLException
Returns a new integer column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(String name,
                                           int scale,
                                           boolean allowsNull)
                                    throws SQLException
Returns a new integer column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
scale - the scale of the integer
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(String name,
                                           int scale,
                                           boolean allowsNull,
                                           Integer defaultValue)
                                    throws SQLException
Returns a new integer column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
scale - the scale of the integer
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(String name,
                                           int scale,
                                           int precision,
                                           boolean allowsNull)
                                    throws SQLException
Returns a new integer column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
scale - the scale of the integer
precision - the precision of the integer
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(String name,
                                           int scale,
                                           int precision,
                                           boolean allowsNull,
                                           Object defaultValue)
                                    throws SQLException
Returns a new integer column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
scale - the scale of the integer
precision - the precision of the integer
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBigIntegerColumn

public ERXMigrationColumn newBigIntegerColumn(String name,
                                              boolean allowsNull)
                                       throws SQLException
Returns a new long column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBigIntegerColumn

public ERXMigrationColumn newBigIntegerColumn(String name,
                                              boolean allowsNull,
                                              Long defaultValue)
                                       throws SQLException
Returns a new long column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newFloatColumn

public ERXMigrationColumn newFloatColumn(String name,
                                         int precision,
                                         int scale,
                                         boolean allowsNull)
                                  throws SQLException
Returns a new float column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
scale - the scale of the float
precision - the precision of the float
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newFloatColumn

public ERXMigrationColumn newFloatColumn(String name,
                                         int precision,
                                         int scale,
                                         boolean allowsNull,
                                         Float defaultValue)
                                  throws SQLException
Returns a new float column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
scale - the scale of the float
precision - the precision of the float
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBigDecimalColumn

public ERXMigrationColumn newBigDecimalColumn(String name,
                                              int precision,
                                              int scale,
                                              boolean allowsNull)
                                       throws SQLException
Returns a new BigDecimal column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
scale - the scale of the BigDecimal
precision - the precision of the BigDecimal
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBigDecimalColumn

public ERXMigrationColumn newBigDecimalColumn(String name,
                                              int precision,
                                              int scale,
                                              boolean allowsNull,
                                              BigDecimal defaultValue)
                                       throws SQLException
Returns a new BigDecimal column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
scale - the scale of the BigDecimal
precision - the precision of the BigDecimal
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBooleanColumn

public ERXMigrationColumn newBooleanColumn(String name,
                                           boolean allowsNull)
                                    throws SQLException
Returns a new varchar(5) boolean column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBooleanColumn

public ERXMigrationColumn newBooleanColumn(String name,
                                           boolean allowsNull,
                                           Boolean defaultValue)
                                    throws SQLException
Returns a new varchar(5) boolean column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIntBooleanColumn

public ERXMigrationColumn newIntBooleanColumn(String name,
                                              boolean allowsNull)
                                       throws SQLException
Returns a new integer boolean column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIntBooleanColumn

public ERXMigrationColumn newIntBooleanColumn(String name,
                                              boolean allowsNull,
                                              Boolean defaultValue)
                                       throws SQLException
Returns a new integer boolean column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newFlagBooleanColumn

public ERXMigrationColumn newFlagBooleanColumn(String name,
                                               boolean allowsNull)
                                        throws SQLException
Returns a new flag boolean column. See newColumn(..) for the full docs. This might or might not work with your database, it's only tested with PostgreSQL.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newClobColumn

public ERXMigrationColumn newClobColumn(String name,
                                        boolean allowsNull)
                                 throws SQLException
Returns a new string blob column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBlobColumn

public ERXMigrationColumn newBlobColumn(String name,
                                        boolean allowsNull)
                                 throws SQLException
Returns a new Blob column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBlobColumn

public ERXMigrationColumn newBlobColumn(String name,
                                        int width,
                                        boolean allowsNull)
                                 throws SQLException
Returns a new Blob column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
width - the width of the blob
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newBlobColumn

public ERXMigrationColumn newBlobColumn(String name,
                                        int width,
                                        boolean allowsNull,
                                        NSData defaultValue)
                                 throws SQLException
Returns a new Blob column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
width - the width of the blob
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newTimestampColumn

public ERXMigrationColumn newTimestampColumn(String name,
                                             boolean allowsNull)
                                      throws SQLException
Returns a new timestamp column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newTimestampColumn

public ERXMigrationColumn newTimestampColumn(String name,
                                             boolean allowsNull,
                                             NSTimestamp defaultValue)
                                      throws SQLException
Returns a new timestamp column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIpAddressColumn

public ERXMigrationColumn newIpAddressColumn(String name,
                                             boolean allowsNull)
                                      throws SQLException
Returns a new ipaddress column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

newIpAddressColumn

public ERXMigrationColumn newIpAddressColumn(String name,
                                             boolean allowsNull,
                                             String defaultValue)
                                      throws SQLException
Returns a new ipaddress column. See newColumn(..) for the full docs.

Parameters:
name - the name of the column
allowsNull - if true, the column will allow null values
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
SQLException - if the column cannot be created

_columnDeleted

public void _columnDeleted(ERXMigrationColumn column)
Callback method for ERXMigrationColumn to notify the table that it has been deleted.

Parameters:
column - the column that has been deleted

_createExpressions

public NSArray<EOSQLExpression> _createExpressions()
Returns an array of EOSQLExpressions for creating this table and all of its ERXMigrationColumns.

Returns:
an array of EOSQLExpressions for creating this table

create

public void create()
            throws SQLException
Executes the SQL operations to create this table.

Throws:
SQLException - if the creation fails

_dropExpressions

public NSArray<EOSQLExpression</