Project Wonder 5.0

er.extensions.migration
Class ERXMigrationTable

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

public class ERXMigrationTable
extends java.lang.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, java.lang.String name)
          Constructs an ERXMigrationTable.
 
Method Summary
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.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).
 com.webobjects.eoaccess.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.
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _createExpressions()
          Returns an array of EOSQLExpressions for creating this table and all of its ERXMigrationColumns.
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _dropExpressions()
          Returns an array of EOSQLExpressions for dropping this table.
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.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(java.lang.String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, java.lang.String overrideValueType, java.lang.Object defaultValue, boolean autocreate)
          Returns a new ERXMigrationColumn with the given attributes.
 com.webobjects.eoaccess.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.
 com.webobjects.eoaccess.EORelationship _newRelationship(ERXMigrationColumn sourceColumn, ERXMigrationColumn destinationColumn)
          Returns a simple single-attribute-mapping EORelationship between two columns.
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _renameToExpressions(java.lang.String newName)
          Returns an array of EOSQLExpressions for renaming this table.
 void _setName(java.lang.String name)
          Sets the name of this table.
 void _setNew(boolean isNew)
          Sets whether or not this table has been created in the database.
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.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(java.lang.String sourceColumnName, ERXMigrationColumn destinationColumn)
          Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).
 void addForeignKey(java.lang.String sourceColumnName, java.lang.String destinationTableName, java.lang.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, java.lang.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(java.lang.String columnName)
          Executes the SQL operations to add this index.
 void addIndex(java.lang.String indexName, ERXMigrationColumn... columns)
          Executes the SQL operations to add an index.
 void addIndex(java.lang.String indexName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Executes the SQL operations to add an index.
 void addIndex(java.lang.String indexName, java.lang.String columnName)
          Executes the SQL operations to add this index.
 void addIndex(java.lang.String indexName, java.lang.String columnName, int width)
          Executes the SQL operations to add this index.
 void addUniqueIndex(boolean create, java.lang.String indexName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Executes the SQL operations to add a unique index.
 void addUniqueIndex(java.lang.String columnName)
          Executes the SQL operations to add this unique index.
 void addUniqueIndex(java.lang.String indexName, ERXMigrationColumn... columns)
          Executes the SQL operations to add a unique index.
 void addUniqueIndex(java.lang.String indexName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Executes the SQL operations to add a unique index.
 void addUniqueIndex(java.lang.String indexName, java.lang.String columnName)
          Executes the SQL operations to add this unique index.
 void addUniqueIndex(java.lang.String indexName, java.lang.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(java.lang.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.
 com.webobjects.foundation.NSArray<java.lang.String> languages()
          Returns the configured default languages for this migration.
 java.lang.String name()
          Returns the name of this table.
 ERXMigrationColumn newBigDecimalColumn(java.lang.String name, int precision, int scale, boolean allowsNull)
          Returns a new BigDecimal column.
 ERXMigrationColumn newBigDecimalColumn(java.lang.String name, int precision, int scale, boolean allowsNull, java.math.BigDecimal defaultValue)
          Returns a new BigDecimal column.
 ERXMigrationColumn newBigIntegerColumn(java.lang.String name, boolean allowsNull)
          Returns a new long column.
 ERXMigrationColumn newBigIntegerColumn(java.lang.String name, boolean allowsNull, java.lang.Long defaultValue)
          Returns a new long column.
 ERXMigrationColumn newBlobColumn(java.lang.String name, boolean allowsNull)
          Returns a new Blob column.
 ERXMigrationColumn newBlobColumn(java.lang.String name, int width, boolean allowsNull)
          Returns a new Blob column.
 ERXMigrationColumn newBlobColumn(java.lang.String name, int width, boolean allowsNull, com.webobjects.foundation.NSData defaultValue)
          Returns a new Blob column.
 ERXMigrationColumn newBooleanColumn(java.lang.String name, boolean allowsNull)
          Returns a new varchar(5) boolean column.
 ERXMigrationColumn newBooleanColumn(java.lang.String name, boolean allowsNull, java.lang.Boolean defaultValue)
          Returns a new varchar(5) boolean column.
 ERXMigrationColumn newClobColumn(java.lang.String name, boolean allowsNull)
          Returns a new string blob column.
 ERXMigrationColumn newColumn(java.lang.String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, java.lang.String overrideValueType)
          Returns a new ERXMigrationColumn with the given attributes.
 ERXMigrationColumn newColumn(java.lang.String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, java.lang.String overrideValueType, java.lang.Object defaultValue)
          Returns a new ERXMigrationColumn with the given attributes.
 ERXMigrationColumn newDateColumn(java.lang.String name, boolean allowsNull)
          Returns a new date column.
 ERXMigrationColumn newDateColumn(java.lang.String name, boolean allowsNull, com.webobjects.foundation.NSTimestamp defaultValue)
          Returns a new date column.
 ERXMigrationColumn newDoubleColumn(java.lang.String name, int precision, int scale, boolean allowsNull)
          Returns a new double column.
 ERXMigrationColumn newDoubleColumn(java.lang.String name, int precision, int scale, boolean allowsNull, java.lang.Double defaultValue)
          Returns a new double column.
 ERXMigrationColumn newFlagBooleanColumn(java.lang.String name, boolean allowsNull)
          Returns a new flag boolean column.
 ERXMigrationColumn newFlagBooleanColumn(java.lang.String name, boolean allowsNull, java.lang.Boolean defaultValue)
          Returns a new flag boolean column.
 ERXMigrationColumn newFloatColumn(java.lang.String name, int precision, int scale, boolean allowsNull)
          Returns a new float column.
 ERXMigrationColumn newFloatColumn(java.lang.String name, int precision, int scale, boolean allowsNull, java.lang.Float defaultValue)
          Returns a new float column.
 ERXMigrationColumn newIntBooleanColumn(java.lang.String name, boolean allowsNull)
          Returns a new integer boolean column.
 ERXMigrationColumn newIntBooleanColumn(java.lang.String name, boolean allowsNull, java.lang.Boolean defaultValue)
          Returns a new integer boolean column.
 ERXMigrationColumn newIntegerColumn(java.lang.String name, boolean allowsNull)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(java.lang.String name, boolean allowsNull, java.lang.Integer defaultValue)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(java.lang.String name, int scale, boolean allowsNull)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(java.lang.String name, int scale, boolean allowsNull, java.lang.Integer defaultValue)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(java.lang.String name, int scale, int precision, boolean allowsNull)
          Returns a new integer column.
 ERXMigrationColumn newIntegerColumn(java.lang.String name, int scale, int precision, boolean allowsNull, java.lang.Object defaultValue)
          Returns a new integer column.
 ERXMigrationColumn newIpAddressColumn(java.lang.String name, boolean allowsNull)
          Returns a new ipaddress column.
 ERXMigrationColumn newIpAddressColumn(java.lang.String name, boolean allowsNull, java.lang.String defaultValue)
          Returns a new ipaddress column.
 ERXMigrationColumn newLargeStringColumn(java.lang.String name, boolean allowsNull)
          Returns a new String column (VARCHAR) that corresponds to the varcharLarge prototype.
 com.webobjects.foundation.NSArray<ERXMigrationColumn> newLocalizedClobColumns(java.lang.String name, boolean allowsNull)
          Returns a new localized string blob column.
 com.webobjects.foundation.NSArray<ERXMigrationColumn> newLocalizedStringColumns(java.lang.String name, int width, boolean allowsNull)
          Returns a new localized String column (VARCHAR).
 com.webobjects.foundation.NSArray<ERXMigrationColumn> newLocalizedStringColumns(java.lang.String name, int width, boolean allowsNull, java.lang.String defaultValue)
          Returns a new localized String column (VARCHAR).
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Object> newPrimaryKey()
          Returns a dictionary that represents the primary key for an entity described by this table.
 com.webobjects.foundation.NSArray<com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Object>> newPrimaryKeys(int count)
          Returns an array of dictionaries that represent the primary keys for an entity described by this table.
 ERXMigrationColumn newSmallIntegerColumn(java.lang.String name, boolean allowsNull)
          Returns a new small integer column.
 ERXMigrationColumn newSmallIntegerColumn(java.lang.String name, boolean allowsNull, java.lang.Short defaultValue)
          Returns a new small integer column.
 ERXMigrationColumn newStringColumn(java.lang.String name, boolean allowsNull)
          Returns a new String column (VARCHAR) with an unbounded length.
 ERXMigrationColumn newStringColumn(java.lang.String name, boolean allowsNull, java.lang.String defaultValue)
          Returns a new String column (VARCHAR) that corresponds to the varcharLarge prototype.
 ERXMigrationColumn newStringColumn(java.lang.String name, int width, boolean allowsNull)
          Returns a new String column (VARCHAR).
 ERXMigrationColumn newStringColumn(java.lang.String name, int width, boolean allowsNull, java.lang.String defaultValue)
          Returns a new String column (VARCHAR).
 ERXMigrationColumn newTimestampColumn(java.lang.String name, boolean allowsNull)
          Returns a new timestamp column.
 ERXMigrationColumn newTimestampColumn(java.lang.String name, boolean allowsNull, com.webobjects.foundation.NSTimestamp defaultValue)
          Returns a new timestamp column.
 void renameTo(java.lang.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(java.lang.String... columnNames)
          Executes the SQL operations to add this primary key constraint.
 void setPrimaryKey(java.lang.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,
                            java.lang.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 com.webobjects.foundation.NSArray<java.lang.String> languages()
Returns the configured default languages for this migration.


_setName

public void _setName(java.lang.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 java.lang.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 com.webobjects.eoaccess.EOEntity _blankEntity()
Returns an EOEntity representing this table with no EOAttributes in it.

Returns:
a shell of an EOEntity for this table

_newEntity

public com.webobjects.eoaccess.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(java.lang.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 com.webobjects.eoaccess.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(java.lang.String name,
                                     int jdbcType,
                                     int width,
                                     int precision,
                                     int scale,
                                     boolean allowsNull,
                                     java.lang.String overrideValueType,
                                     java.lang.Object defaultValue,
                                     boolean autocreate)
                              throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newColumn

public ERXMigrationColumn newColumn(java.lang.String name,
                                    int jdbcType,
                                    int width,
                                    int precision,
                                    int scale,
                                    boolean allowsNull,
                                    java.lang.String overrideValueType,
                                    java.lang.Object defaultValue)
                             throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newColumn

public ERXMigrationColumn newColumn(java.lang.String name,
                                    int jdbcType,
                                    int width,
                                    int precision,
                                    int scale,
                                    boolean allowsNull,
                                    java.lang.String overrideValueType)
                             throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newStringColumn

public ERXMigrationColumn newStringColumn(java.lang.String name,
                                          int width,
                                          boolean allowsNull)
                                   throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newStringColumn

public ERXMigrationColumn newStringColumn(java.lang.String name,
                                          int width,
                                          boolean allowsNull,
                                          java.lang.String defaultValue)
                                   throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newStringColumn

public ERXMigrationColumn newStringColumn(java.lang.String name,
                                          boolean allowsNull)
                                   throws java.sql.SQLException
Returns a new String column (VARCHAR) with an unbounded length. 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:
java.sql.SQLException - if the column cannot be created

newLargeStringColumn

public ERXMigrationColumn newLargeStringColumn(java.lang.String name,
                                               boolean allowsNull)
                                        throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newStringColumn

public ERXMigrationColumn newStringColumn(java.lang.String name,
                                          boolean allowsNull,
                                          java.lang.String defaultValue)
                                   throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newLocalizedStringColumns

public com.webobjects.foundation.NSArray<ERXMigrationColumn> newLocalizedStringColumns(java.lang.String name,
                                                                                       int width,
                                                                                       boolean allowsNull)
                                                                                throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newLocalizedStringColumns

public com.webobjects.foundation.NSArray<ERXMigrationColumn> newLocalizedStringColumns(java.lang.String name,
                                                                                       int width,
                                                                                       boolean allowsNull,
                                                                                       java.lang.String defaultValue)
                                                                                throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newLocalizedClobColumns

public com.webobjects.foundation.NSArray<ERXMigrationColumn> newLocalizedClobColumns(java.lang.String name,
                                                                                     boolean allowsNull)
                                                                              throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(java.lang.String name,
                                           boolean allowsNull)
                                    throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(java.lang.String name,
                                           boolean allowsNull,
                                           java.lang.Integer defaultValue)
                                    throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(java.lang.String name,
                                           int scale,
                                           boolean allowsNull)
                                    throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(java.lang.String name,
                                           int scale,
                                           boolean allowsNull,
                                           java.lang.Integer defaultValue)
                                    throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(java.lang.String name,
                                           int scale,
                                           int precision,
                                           boolean allowsNull)
                                    throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIntegerColumn

public ERXMigrationColumn newIntegerColumn(java.lang.String name,
                                           int scale,
                                           int precision,
                                           boolean allowsNull,
                                           java.lang.Object defaultValue)
                                    throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newSmallIntegerColumn

public ERXMigrationColumn newSmallIntegerColumn(java.lang.String name,
                                                boolean allowsNull)
                                         throws java.sql.SQLException
Returns a new small 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:
java.sql.SQLException - if the column cannot be created

newSmallIntegerColumn

public ERXMigrationColumn newSmallIntegerColumn(java.lang.String name,
                                                boolean allowsNull,
                                                java.lang.Short defaultValue)
                                         throws java.sql.SQLException
Returns a new small 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:
java.sql.SQLException - if the column cannot be created

newBigIntegerColumn

public ERXMigrationColumn newBigIntegerColumn(java.lang.String name,
                                              boolean allowsNull)
                                       throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newBigIntegerColumn

public ERXMigrationColumn newBigIntegerColumn(java.lang.String name,
                                              boolean allowsNull,
                                              java.lang.Long defaultValue)
                                       throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newFloatColumn

public ERXMigrationColumn newFloatColumn(java.lang.String name,
                                         int precision,
                                         int scale,
                                         boolean allowsNull)
                                  throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newFloatColumn

public ERXMigrationColumn newFloatColumn(java.lang.String name,
                                         int precision,
                                         int scale,
                                         boolean allowsNull,
                                         java.lang.Float defaultValue)
                                  throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newDoubleColumn

public ERXMigrationColumn newDoubleColumn(java.lang.String name,
                                          int precision,
                                          int scale,
                                          boolean allowsNull)
                                   throws java.sql.SQLException
Returns a new double column. See newColumn(..) for the full docs.

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

newDoubleColumn

public ERXMigrationColumn newDoubleColumn(java.lang.String name,
                                          int precision,
                                          int scale,
                                          boolean allowsNull,
                                          java.lang.Double defaultValue)
                                   throws java.sql.SQLException
Returns a new double column. See newColumn(..) for the full docs.

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

newBigDecimalColumn

public ERXMigrationColumn newBigDecimalColumn(java.lang.String name,
                                              int precision,
                                              int scale,
                                              boolean allowsNull)
                                       throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newBigDecimalColumn

public ERXMigrationColumn newBigDecimalColumn(java.lang.String name,
                                              int precision,
                                              int scale,
                                              boolean allowsNull,
                                              java.math.BigDecimal defaultValue)
                                       throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newBooleanColumn

public ERXMigrationColumn newBooleanColumn(java.lang.String name,
                                           boolean allowsNull)
                                    throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newBooleanColumn

public ERXMigrationColumn newBooleanColumn(java.lang.String name,
                                           boolean allowsNull,
                                           java.lang.Boolean defaultValue)
                                    throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIntBooleanColumn

public ERXMigrationColumn newIntBooleanColumn(java.lang.String name,
                                              boolean allowsNull)
                                       throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIntBooleanColumn

public ERXMigrationColumn newIntBooleanColumn(java.lang.String name,
                                              boolean allowsNull,
                                              java.lang.Boolean defaultValue)
                                       throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newFlagBooleanColumn

public ERXMigrationColumn newFlagBooleanColumn(java.lang.String name,
                                               boolean allowsNull)
                                        throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newFlagBooleanColumn

public ERXMigrationColumn newFlagBooleanColumn(java.lang.String name,
                                               boolean allowsNull,
                                               java.lang.Boolean defaultValue)
                                        throws java.sql.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
defaultValue - the default value of this column
Returns:
the new ERXMigrationColumn
Throws:
java.sql.SQLException - if the column cannot be created

newClobColumn

public ERXMigrationColumn newClobColumn(java.lang.String name,
                                        boolean allowsNull)
                                 throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newBlobColumn

public ERXMigrationColumn newBlobColumn(java.lang.String name,
                                        boolean allowsNull)
                                 throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newBlobColumn

public ERXMigrationColumn newBlobColumn(java.lang.String name,
                                        int width,
                                        boolean allowsNull)
                                 throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newBlobColumn

public ERXMigrationColumn newBlobColumn(java.lang.String name,
                                        int width,
                                        boolean allowsNull,
                                        com.webobjects.foundation.NSData defaultValue)
                                 throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newTimestampColumn

public ERXMigrationColumn newTimestampColumn(java.lang.String name,
                                             boolean allowsNull)
                                      throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newTimestampColumn

public ERXMigrationColumn newTimestampColumn(java.lang.String name,
                                             boolean allowsNull,
                                             com.webobjects.foundation.NSTimestamp defaultValue)
                                      throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newDateColumn

public ERXMigrationColumn newDateColumn(java.lang.String name,
                                        boolean allowsNull)
                                 throws java.sql.SQLException
Returns a new date 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:
java.sql.SQLException - if the column cannot be created

newDateColumn

public ERXMigrationColumn newDateColumn(java.lang.String name,
                                        boolean allowsNull,
                                        com.webobjects.foundation.NSTimestamp defaultValue)
                                 throws java.sql.SQLException
Returns a new date 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:
java.sql.SQLException - if the column cannot be created

newIpAddressColumn

public ERXMigrationColumn newIpAddressColumn(java.lang.String name,
                                             boolean allowsNull)
                                      throws java.sql.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:
java.sql.SQLException - if the column cannot be created

newIpAddressColumn

public ERXMigrationColumn newIpAddressColumn(java.lang.String name,
                                             boolean allowsNull,
                                             java.lang.String defaultValue)
                                      throws java.sql.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:
java.sql.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 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.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 java.sql.SQLException
Executes the SQL operations to create this table.

Throws:
java.sql.SQLException - if the creation fails

_dropExpressions

public com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _dropExpressions()
Returns an array of EOSQLExpressions for dropping this table.

Returns:
an array of EOSQLExpressions for dropping this table

drop

public void drop()
          throws java.sql.SQLException
Executes the SQL operations to drop this table.

Throws:
java.sql.SQLException - if the drop fails

_renameToExpressions

public com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _renameToExpressions(java.lang.String newName)
Returns an array of EOSQLExpressions for renaming this table.

Returns:
an array of EOSQLExpressions for renaming this table

renameTo

public void renameTo(java.lang.String newName)
              throws java.sql.SQLException
Executes the SQL operations to rename this table.

Throws:
java.sql.SQLException - if the rename fails

_setPrimaryKeyExpressions

public com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _setPrimaryKeyExpressions(ERXMigrationColumn... columns)
Returns an array of EOSQLExpressions for setting the primary key constraint of this table

Returns:
an array of EOSQLExpressions for setting the primary key constraint of this table

addUniqueIndex

public void addUniqueIndex(java.lang.String columnName)
                    throws java.sql.SQLException
Executes the SQL operations to add this unique index.

Parameters:
columnName - the name of the column to add a unique index on
Throws:
java.sql.SQLException - if the constraint fails

addUniqueIndex

public void addUniqueIndex(java.lang.String indexName,
                           java.lang.String columnName)
                    throws java.sql.SQLException
Executes the SQL operations to add this unique index.

Parameters:
indexName - the name of the index
columnName - the name of the column to add a unique index on
Throws:
java.sql.SQLException - if the constraint fails

addUniqueIndex

public void addUniqueIndex(java.lang.String indexName,
                           java.lang.String columnName,
                           int width)
                    throws java.sql.SQLException
Executes the SQL operations to add this unique index.

Parameters:
indexName - the name of the index
columnName - the name of the column to add a unique index on
Throws:
java.sql.SQLException - if the constraint fails

addUniqueIndex

public void addUniqueIndex(java.lang.String indexName,
                           ERXMigrationColumn... columns)
                    throws java.sql.SQLException
Executes the SQL operations to add a unique index.

Parameters:
indexName - the name of the index
columns - the columns to add a unique index on
Throws:
java.sql.SQLException - if the constraint fails

addUniqueIndex

public void addUniqueIndex(java.lang.String indexName,
                           ERXSQLHelper.ColumnIndex... columnIndexes)
                    throws java.sql.SQLException
Executes the SQL operations to add a unique index.

Parameters:
indexName - the name of the index
columnIndexes - the column indexes to unique index on
Throws:
java.sql.SQLException - if the constraint fails

addUniqueIndex

public void addUniqueIndex(boolean create,
                           java.lang.String indexName,
                           ERXSQLHelper.ColumnIndex... columnIndexes)
                    throws java.sql.SQLException
Executes the SQL operations to add a unique index.

Parameters:
create - if true, the index is created immediately
indexName - the name of the index
columnIndexes - the column indexes to unique index on
Throws:
java.sql.SQLException - if the constraint fails

addIndex

public void addIndex(java.lang.String columnName)
              throws java.sql.SQLException
Executes the SQL operations to add this index.

Parameters:
columnName - the name of the column to add a unique index on
Throws:
java.sql.SQLException - if the constraint fails

addIndex

public void addIndex(java.lang.String indexName,
                     java.lang.String columnName)
              throws java.sql.SQLException
Executes the SQL operations to add this index.

Parameters:
indexName - the name of the index
columnName - the name of the column to add a unique index on
Throws:
java.sql.SQLException - if the constraint fails

addIndex

public void addIndex(java.lang.String indexName,
                     java.lang.String columnName,
                     int width)
              throws java.sql.SQLException
Executes the SQL operations to add this index.

Parameters:
indexName - the name of the index
columnName - the name of the column to add a unique index on
Throws:
java.sql.SQLException - if the constraint fails

addIndex

public void addIndex(java.lang.String indexName,
                     ERXMigrationColumn... columns)
              throws java.sql.SQLException
Executes the SQL operations to add an index.

Parameters:
indexName - the name of the index
columns - the columns to add a unique index on
Throws:
java.sql.SQLException - if the constraint fails

addIndex

public void addIndex(java.lang.String indexName,
                     ERXSQLHelper.ColumnIndex... columnIndexes)
              throws java.sql.SQLException
Executes the SQL operations to add an index.

Parameters:
indexName - the name of the index
columnIndexes - the column indexes to unique index on
Throws:
java.sql.SQLException - if the constraint fails

addIndex

public void addIndex(boolean create,
                     java.lang.String indexName,
                     ERXSQLHelper.ColumnIndex... columnIndexes)
              throws java.sql.SQLException
Executes the SQL operations to add an index.

Parameters:
create - if true, the index is created immediately
indexName - the name of the index
columnIndexes - the column indexes to unique index on
Throws:
java.sql.SQLException - if the constraint fails

addIndex

public void addIndex(ERXMigrationIndex index)
              throws java.sql.SQLException
Executes the SQL operations to add an index.

Parameters:
index - the index to add
Throws:
java.sql.SQLException - if the constraint fails

addIndex

public void addIndex(boolean create,
                     ERXMigrationIndex index)
              throws java.sql.SQLException
Executes the SQL operations to add an index.

Parameters:
create - if true, the index is created immediately
index - the index to add
Throws:
java.sql.SQLException - if the constraint fails

setPrimaryKey

public void setPrimaryKey(java.lang.String columnName)
                   throws java.sql.SQLException
Executes the SQL operations to add this primary key constraint.

Parameters:
columnName - the name of the column to set as the primary key
Throws:
java.sql.SQLException - if the constraint fails

setPrimaryKey

public void setPrimaryKey(java.lang.String... columnNames)
                   throws java.sql.SQLException
Executes the SQL operations to add this primary key constraint.

Parameters:
columnNames - the names of the columns to set as the primary key
Throws:
java.sql.SQLException - if the constraint fails

setPrimaryKey

public void setPrimaryKey(ERXMigrationColumn... columns)
                   throws java.sql.SQLException
Executes the SQL operations to add this primary key constraint.

Parameters:
columns - the primary key columns to designate as primary keys
Throws:
java.sql.SQLException - if the constraint fails

setPrimaryKey

public void setPrimaryKey(boolean create,
                          ERXMigrationColumn... columns)
                   throws java.sql.SQLException
Executes the SQL operations to add this primary key constraint.

Parameters:
create - if create is true, execute this now (vs just flag the ERXMigrationColumn)
columns - the primary key columns to designate as primary keys
Throws:
java.sql.SQLException - if the constraint fails

_addForeignKeyExpressions

public com.webobjects.foundation.NSArray<com.webobjects.eoaccess.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).

Returns:
an array of EOSQLExpressions for adding a foreign key constraint to this table

addForeignKey

public void addForeignKey(java.lang.String sourceColumnName,
                          java.lang.String destinationTableName,
                          java.lang.String destinationColumnName)
                   throws java.sql.SQLException
Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).

Parameters:
sourceColumnName - the source column name of the relationship
destinationTableName - the destination table of the relationship (should be the PK of the destination table)
destinationColumnName - the destination column of the relationship (should be the PK of the destination table)
Throws:
java.sql.SQLException - if the add fails

addForeignKey

public void addForeignKey(java.lang.String sourceColumnName,
                          ERXMigrationColumn destinationColumn)
                   throws java.sql.SQLException
Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).

Parameters:
sourceColumnName - the source column name of the relationship
destinationColumn - the destination column of the relationship (should be the PK of the destination table)
Throws:
java.sql.SQLException - if the add fails

addForeignKey

public void addForeignKey(ERXMigrationColumn sourceColumn,
                          ERXMigrationColumn destinationColumn)
                   throws java.sql.SQLException
Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).

Parameters:
sourceColumn - the source column of the relationship
destinationColumn - the destination column of the relationship (should be the PK of the destination table)
Throws:
java.sql.SQLException - if the add fails

addForeignKey

public void addForeignKey(boolean create,
                          ERXMigrationColumn sourceColumn,
                          ERXMigrationColumn destinationColumn)
                   throws java.sql.SQLException
Executes the SQL operations to add this foreign key constraint (only supports single attribute FK's right now).

Parameters:
sourceColumn - the source column of the relationship
destinationColumn - the destination column of the relationship (should be the PK of the destination table)
Throws:
java.sql.SQLException - if the add fails

_dropPrimaryKeyExpressions

public com.webobjects.foundation.NSArray<com.webobjects.eoaccess.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).

Parameters:
columns - the primary key columns to drop
Returns:
an array of EOSQLExpressions for removing the primary key constraint of this table

dropPrimaryKey

public void dropPrimaryKey(ERXMigrationColumn... columns)
                    throws java.sql.SQLException
Executes the SQL operations to drop this primary key constraint (only supports single attribute PK's right now).

Parameters:
columns - the primary key columns
Throws:
java.sql.SQLException - if the drop fails

newPrimaryKey

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Object> newPrimaryKey()
Returns a dictionary that represents the primary key for an entity described by this table. Note that you must have specified the primary key columns for this table prior to calling this method via the setPrimaryKeys method (or calling _setPrimaryKey on the individual columns).

Returns:
a dictionary of a primary key

newPrimaryKeys

public com.webobjects.foundation.NSArray<com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Object>> newPrimaryKeys(int count)
Returns an array of dictionaries that represent the primary keys for an entity described by this table. Note that you must have specified the primary key columns for this table prior to calling this method via the setPrimaryKeys method (or calling _setPrimaryKey on the individual columns).

Parameters:
count - the number of primary keys desired
Returns:
an array of dictionaries of primary keys

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.