public class ERXMigrationTable extends Object
Modifier | Constructor and Description |
---|---|
protected |
ERXMigrationTable(ERXMigrationDatabase database,
String name)
Constructs an ERXMigrationTable.
|
Modifier and Type | Method and Description |
---|---|
void |
_addForeignKey(ERXMigrationForeignKey foreignKey)
Adds a pending foreign key to this table.
|
NSArray<EOSQLExpression> |
_addForeignKeyExpressions(ERXMigrationColumn[] sourceColumns,
ERXMigrationColumn[] destinationColumns)
Returns an array of EOSQLExpressions for adding a foreign key constraint to this table.
|
NSArray<EOSQLExpression> |
_addForeignKeyExpressions(ERXMigrationColumn sourceColumn,
ERXMigrationColumn destinationColumn)
Returns an array of EOSQLExpressions for adding a foreign key constraint to this table.
|
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[] sourceColumns,
ERXMigrationColumn[] destinationColumns)
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[] sourceColumns,
ERXMigrationColumn[] destinationColumns)
Executes the SQL operations to add this foreign key constraint.
|
void |
addForeignKey(boolean create,
ERXMigrationColumn sourceColumn,
ERXMigrationColumn destinationColumn)
Executes the SQL operations to add this foreign key constraint.
|
void |
addForeignKey(ERXMigrationColumn[] sourceColumns,
ERXMigrationColumn[] destinationColumns)
Executes the SQL operations to add this foreign key constraint.
|
void |
addForeignKey(ERXMigrationColumn sourceColumn,
ERXMigrationColumn destinationColumn)
Executes the SQL operations to add this foreign key constraint.
|
void |
addForeignKey(String sourceColumnName,
ERXMigrationColumn destinationColumn)
Executes the SQL operations to add this foreign key constraint.
|
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 |
newDateColumn(String name,
boolean allowsNull)
Returns a new date column.
|
ERXMigrationColumn |
newDateColumn(String name,
boolean allowsNull,
NSTimestamp defaultValue)
Returns a new date column.
|
ERXMigrationColumn |
newDoubleColumn(String name,
int precision,
int scale,
boolean allowsNull)
Returns a new double column.
|
ERXMigrationColumn |
newDoubleColumn(String name,
int precision,
int scale,
boolean allowsNull,
Double defaultValue)
Returns a new double column.
|
ERXMigrationColumn |
newFlagBooleanColumn(String name,
boolean allowsNull)
Returns a new flag boolean column.
|
ERXMigrationColumn |
newFlagBooleanColumn(String name,
boolean allowsNull,
Boolean defaultValue)
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> |
newLocalizedClobColumns(String name,
boolean allowsNull,
NSArray<String> languages)
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,
NSArray<String> languages)
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).
|
NSArray<ERXMigrationColumn> |
newLocalizedStringColumns(String name,
int width,
boolean allowsNull,
String defaultValue,
NSArray<String> languages)
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 |
newSmallIntegerColumn(String name,
boolean allowsNull)
Returns a new small integer column.
|
ERXMigrationColumn |
newSmallIntegerColumn(String name,
boolean allowsNull,
Short defaultValue)
Returns a new small integer column.
|
ERXMigrationColumn |
newStringColumn(String name,
boolean allowsNull)
Returns a new String column (VARCHAR) with an unbounded length.
|
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 |
newTimeColumn(String name,
boolean allowsNull)
Returns a new time column.
|
ERXMigrationColumn |
newTimestampColumn(String name,
boolean allowsNull)
Returns a new timestamp column.
|
ERXMigrationColumn |
newTimestampColumn(String name,
boolean allowsNull,
NSTimestamp defaultValue)
Returns a new timestamp column.
|
ERXMigrationColumn |
newUuidColumn(String name,
boolean allowsNull)
Returns a new UUID 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.
|
protected ERXMigrationTable(ERXMigrationDatabase database, String name)
database
- the database this table is withinname
- the name of this tablepublic ERXMigrationDatabase database()
public NSArray<String> languages()
public void _setName(String name)
name
- the name of this tablepublic String name()
public boolean isNew()
public void _setNew(boolean isNew)
isNew
- if true, the table has been createdpublic EOEntity _blankEntity()
public EOEntity _newEntity()
public ERXMigrationColumn existingColumnNamed(String name)
name
- the name of the column to retrievepublic EORelationship _newRelationship(ERXMigrationColumn[] sourceColumns, ERXMigrationColumn[] destinationColumns)
sourceColumns
- the source attributes of the relationshipdestinationColumns
- the destination attributes of the relationshippublic ERXMigrationColumn _newColumn(String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, String overrideValueType, Object defaultValue, boolean autocreate) throws SQLException
name
- the name of the column to createjdbcType
- 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 valuesoverrideValueType
- value type associated with the underlying attribute (or null
for autoselect)defaultValue
- the default value for the columnautocreate
- if true
will call create on new columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newColumn(String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, String overrideValueType, Object defaultValue) throws SQLException
name
- the name of the column to createjdbcType
- 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 valuesoverrideValueType
- value type associated with the underlying attribute (or null
for autoselect)defaultValue
- the default value for the columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newColumn(String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, String overrideValueType) throws SQLException
name
- the name of the column to createjdbcType
- 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 valuesoverrideValueType
- value type associated with the underlying attribute (or null
for autoselect)SQLException
- if the column cannot be createdpublic ERXMigrationColumn newStringColumn(String name, int width, boolean allowsNull) throws SQLException
name
- the name of the columnwidth
- the max width of the varcharallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newStringColumn(String name, int width, boolean allowsNull, String defaultValue) throws SQLException
name
- the name of the columnwidth
- the max width of the varcharallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newStringColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newLargeStringColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newStringColumn(String name, boolean allowsNull, String defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic NSArray<ERXMigrationColumn> newLocalizedStringColumns(String name, int width, boolean allowsNull) throws SQLException
name
- the name of the columnwidth
- the max width of the varcharallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic NSArray<ERXMigrationColumn> newLocalizedStringColumns(String name, int width, boolean allowsNull, NSArray<String> languages) throws SQLException
name
- the name of the columnwidth
- the max width of the varcharallowsNull
- if true, the column will allow null valueslanguages
- the languages [ex. ("en","ja","fr")]SQLException
- if the column cannot be createdpublic NSArray<ERXMigrationColumn> newLocalizedStringColumns(String name, int width, boolean allowsNull, String defaultValue) throws SQLException
name
- the name of the columnwidth
- the max width of the varcharallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic NSArray<ERXMigrationColumn> newLocalizedStringColumns(String name, int width, boolean allowsNull, String defaultValue, NSArray<String> languages) throws SQLException
name
- the name of the columnwidth
- the max width of the varcharallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnlanguages
- the languages [ex. ("en","ja","fr")]SQLException
- if the column cannot be createdpublic NSArray<ERXMigrationColumn> newLocalizedClobColumns(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic NSArray<ERXMigrationColumn> newLocalizedClobColumns(String name, boolean allowsNull, NSArray<String> languages) throws SQLException
name
- the name of the columnlanguages
- the languages [ex. ("en","ja","fr")]allowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIntegerColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIntegerColumn(String name, boolean allowsNull, Integer defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIntegerColumn(String name, int scale, boolean allowsNull) throws SQLException
name
- the name of the columnscale
- the scale of the integerallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIntegerColumn(String name, int scale, boolean allowsNull, Integer defaultValue) throws SQLException
name
- the name of the columnscale
- the scale of the integerallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIntegerColumn(String name, int scale, int precision, boolean allowsNull) throws SQLException
name
- the name of the columnscale
- the scale of the integerprecision
- the precision of the integerallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIntegerColumn(String name, int scale, int precision, boolean allowsNull, Object defaultValue) throws SQLException
name
- the name of the columnscale
- the scale of the integerprecision
- the precision of the integerallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newSmallIntegerColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newSmallIntegerColumn(String name, boolean allowsNull, Short defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBigIntegerColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBigIntegerColumn(String name, boolean allowsNull, Long defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newFloatColumn(String name, int precision, int scale, boolean allowsNull) throws SQLException
name
- the name of the columnscale
- the scale of the floatprecision
- the precision of the floatallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newFloatColumn(String name, int precision, int scale, boolean allowsNull, Float defaultValue) throws SQLException
name
- the name of the columnscale
- the scale of the floatprecision
- the precision of the floatallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newDoubleColumn(String name, int precision, int scale, boolean allowsNull) throws SQLException
name
- the name of the columnscale
- the scale of the doubleprecision
- the precision of the doubleallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newDoubleColumn(String name, int precision, int scale, boolean allowsNull, Double defaultValue) throws SQLException
name
- the name of the columnscale
- the scale of the doubleprecision
- the precision of the doubleallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBigDecimalColumn(String name, int precision, int scale, boolean allowsNull) throws SQLException
name
- the name of the columnscale
- the scale of the BigDecimalprecision
- the precision of the BigDecimalallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBigDecimalColumn(String name, int precision, int scale, boolean allowsNull, BigDecimal defaultValue) throws SQLException
name
- the name of the columnscale
- the scale of the BigDecimalprecision
- the precision of the BigDecimalallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBooleanColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBooleanColumn(String name, boolean allowsNull, Boolean defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIntBooleanColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIntBooleanColumn(String name, boolean allowsNull, Boolean defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newFlagBooleanColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newFlagBooleanColumn(String name, boolean allowsNull, Boolean defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newClobColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBlobColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBlobColumn(String name, int width, boolean allowsNull) throws SQLException
name
- the name of the columnwidth
- the width of the bloballowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newBlobColumn(String name, int width, boolean allowsNull, NSData defaultValue) throws SQLException
name
- the name of the columnwidth
- the width of the bloballowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newTimestampColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newTimestampColumn(String name, boolean allowsNull, NSTimestamp defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newDateColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newDateColumn(String name, boolean allowsNull, NSTimestamp defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newTimeColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIpAddressColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic ERXMigrationColumn newIpAddressColumn(String name, boolean allowsNull, String defaultValue) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesdefaultValue
- the default value of this columnSQLException
- if the column cannot be createdpublic ERXMigrationColumn newUuidColumn(String name, boolean allowsNull) throws SQLException
name
- the name of the columnallowsNull
- if true, the column will allow null valuesSQLException
- if the column cannot be createdpublic void _columnDeleted(ERXMigrationColumn column)
column
- the column that has been deletedpublic NSArray<EOSQLExpression> _createExpressions()
public void create() throws SQLException
SQLException
- if the creation failspublic NSArray<EOSQLExpression> _dropExpressions()
public void drop() throws SQLException
SQLException
- if the drop failspublic NSArray<EOSQLExpression> _renameToExpressions(String newName)
newName
- new table namepublic void renameTo(String newName) throws SQLException
newName
- new table nameSQLException
- if the rename failspublic NSArray<EOSQLExpression> _setPrimaryKeyExpressions(ERXMigrationColumn... columns)
columns
- public void addUniqueIndex(String columnName) throws SQLException
columnName
- the name of the column to add a unique index onSQLException
- if the constraint failspublic void addUniqueIndex(String indexName, String columnName) throws SQLException
indexName
- the name of the indexcolumnName
- the name of the column to add a unique index onSQLException
- if the constraint failspublic void addUniqueIndex(String indexName, String columnName, int width) throws SQLException
indexName
- the name of the indexcolumnName
- the name of the column to add a unique index onwidth
- SQLException
- if the constraint failspublic void addUniqueIndex(String indexName, ERXMigrationColumn... columns) throws SQLException
indexName
- the name of the indexcolumns
- the columns to add a unique index onSQLException
- if the constraint failspublic void addUniqueIndex(String indexName, ERXSQLHelper.ColumnIndex... columnIndexes) throws SQLException
indexName
- the name of the indexcolumnIndexes
- the column indexes to unique index onSQLException
- if the constraint failspublic void addUniqueIndex(boolean create, String indexName, ERXSQLHelper.ColumnIndex... columnIndexes) throws SQLException
create
- if true, the index is created immediatelyindexName
- the name of the indexcolumnIndexes
- the column indexes to unique index onSQLException
- if the constraint failspublic void addIndex(String columnName) throws SQLException
columnName
- the name of the column to add a unique index onSQLException
- if the constraint failspublic void addIndex(String indexName, String columnName) throws SQLException
indexName
- the name of the indexcolumnName
- the name of the column to add a unique index onSQLException
- if the constraint failspublic void addIndex(String indexName, String columnName, int width) throws SQLException
indexName
- the name of the indexcolumnName
- the name of the column to add a unique index onwidth
- SQLException
- if the constraint failspublic void addIndex(String indexName, ERXMigrationColumn... columns) throws SQLException
indexName
- the name of the indexcolumns
- the columns to add a unique index onSQLException
- if the constraint failspublic void addIndex(String indexName, ERXSQLHelper.ColumnIndex... columnIndexes) throws SQLException
indexName
- the name of the indexcolumnIndexes
- the column indexes to unique index onSQLException
- if the constraint failspublic void addIndex(boolean create, String indexName, ERXSQLHelper.ColumnIndex... columnIndexes) throws SQLException
create
- if true, the index is created immediatelyindexName
- the name of the indexcolumnIndexes
- the column indexes to unique index onSQLException
- if the constraint failspublic void addIndex(ERXMigrationIndex index) throws SQLException
index
- the index to addSQLException
- if the constraint failspublic void addIndex(boolean create, ERXMigrationIndex index) throws SQLException
create
- if true, the index is created immediatelyindex
- the index to addSQLException
- if the constraint failspublic void setPrimaryKey(String columnName) throws SQLException
columnName
- the name of the column to set as the primary keySQLException
- if the constraint failspublic void setPrimaryKey(String... columnNames) throws SQLException
columnNames
- the names of the columns to set as the primary keySQLException
- if the constraint failspublic void setPrimaryKey(ERXMigrationColumn... columns) throws SQLException
columns
- the primary key columns to designate as primary keysSQLException
- if the constraint failspublic void setPrimaryKey(boolean create, ERXMigrationColumn... columns) throws SQLException
create
- if create is true, execute this now (vs just flag the ERXMigrationColumn)columns
- the primary key columns to designate as primary keysSQLException
- if the constraint failspublic void _addForeignKey(ERXMigrationForeignKey foreignKey)
foreignKey
- the new foreign keypublic NSArray<EOSQLExpression> _addForeignKeyExpressions(ERXMigrationColumn sourceColumn, ERXMigrationColumn destinationColumn)
sourceColumn
- the source column of the relationshipdestinationColumn
- the destination columns of the relationship (should be the PK of the destination table)public NSArray<EOSQLExpression> _addForeignKeyExpressions(ERXMigrationColumn[] sourceColumns, ERXMigrationColumn[] destinationColumns)
sourceColumns
- the source columns of the relationshipdestinationColumns
- the destination columns of the relationship (should be the PKs of the destination table)public void addForeignKey(String sourceColumnName, String destinationTableName, String destinationColumnName) throws SQLException
sourceColumnName
- the source column name of the relationshipdestinationTableName
- 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)SQLException
- if the add failspublic void addForeignKey(String sourceColumnName, ERXMigrationColumn destinationColumn) throws SQLException
sourceColumnName
- the source column name of the relationshipdestinationColumn
- the destination column of the relationship (should be the PK of the destination table)SQLException
- if the add failspublic void addForeignKey(ERXMigrationColumn sourceColumn, ERXMigrationColumn destinationColumn) throws SQLException
sourceColumn
- the source column of the relationshipdestinationColumn
- the destination column of the relationship (should be the PK of the destination table)SQLException
- if the add failspublic void addForeignKey(ERXMigrationColumn[] sourceColumns, ERXMigrationColumn[] destinationColumns) throws SQLException
sourceColumns
- the source columns of the relationshipdestinationColumns
- the destination columns of the relationship (should be the PKs of the destination table)SQLException
- if the add failspublic void addForeignKey(boolean create, ERXMigrationColumn sourceColumn, ERXMigrationColumn destinationColumn) throws SQLException
create
- if create is true, execute this now (vs just flag the ERXMigrationColumn)sourceColumn
- the source column of the relationshipdestinationColumn
- the destination column of the relationship (should be the PK of the destination table)SQLException
- if the add failspublic void addForeignKey(boolean create, ERXMigrationColumn[] sourceColumns, ERXMigrationColumn[] destinationColumns) throws SQLException
create
- if create is true, execute this now (vs just flag the ERXMigrationColumn)sourceColumns
- the source columns of the relationshipdestinationColumns
- the destination columns of the relationship (should be the PKs of the destination table)SQLException
- if the add failspublic NSArray<EOSQLExpression> _dropPrimaryKeyExpressions(ERXMigrationColumn... columns)
columns
- the primary key columns to droppublic void dropPrimaryKey(ERXMigrationColumn... columns) throws SQLException
columns
- the primary key columnsSQLException
- if the drop failspublic NSDictionary<String,Object> newPrimaryKey()
public NSArray<NSDictionary<String,Object>> newPrimaryKeys(int count)
count
- the number of primary keys desiredCopyright © 2002 – 2024 Project Wonder.