abstract class Doctrine_Migration_Base (View source)

Base migration class. All migration classes must extend from this base class

Properties

protected $_changes
static protected $_opposites

Methods

array
getChanges()

Get the changes that have been added on this migration class instance

getNumChanges()

No description

void
_addChange(string $type, array $change = array())

Add a change to the stack of changes to execute

static 
setDefaultTableOptions(array $options)

Sets the default options for tables created using Doctrine_Migration_Base::createTable()

static array
getDefaultTableOptions()

Returns the default options for tables created using Doctrine_Migration_Base::createTable()

void
table(string $upDown, string $tableName, array $fields = array(), array $options = array())

Add a create or drop table change.

void
createTable(string $tableName, array $fields = array(), array $options = array())

Add a create table change.

void
dropTable(string $tableName)

Add a drop table change.

void
renameTable(string $oldTableName, string $newTableName)

Add a rename table change

void
constraint(string $upDown, string $tableName, string $constraintName, array $definition)

Add a create or drop constraint change.

void
createConstraint($tableName, $constraintName, array $definition)

Add a create constraint change.

void
dropConstraint($tableName, $constraintName, $primary = false)

Add a drop constraint change.

void
primaryKey(string $direction, string $tableName, string $columnNames)

Convenience method for creating or dropping primary keys.

void
createPrimaryKey(string $tableName, string $columnNames)

Convenience method for creating primary keys

void
dropPrimaryKey(string $tableName, string $columnNames)

Convenience method for dropping primary keys.

void
foreignKey(string $upDown, string $tableName, string $name, array $definition = array())

Add a create or drop foreign key change.

void
createForeignKey(string $tableName, string $name, array $definition)

Add a create foreign key change.

void
dropForeignKey(string $tableName, string $name)

Add a drop foreign key change.

void
column(string $upDown, string $tableName, string $columnName, string $type = null, string $length = null, array $options = array())

Add a add or remove column change.

void
addColumn(string $tableName, string $columnName, string $type, string $length = null, array $options = array())

Add a add column change.

void
removeColumn(string $tableName, string $columnName)

Add a remove column change.

void
renameColumn(string $tableName, string $oldColumnName, string $newColumnName)

Add a rename column change

void
changeColumn(string $tableName, string $columnName, string $type = null, string $length = null, array $options = array())

Add a change column change

void
index(string $upDown, string $tableName, string $indexName, array $definition = array())

Add a add or remove index change.

void
addIndex(string $tableName, string $indexName, array $definition)

Add a add index change.

void
removeIndex(string $tableName, string $indexName)

Add a remove index change.

preUp()

No description

postUp()

No description

preDown()

No description

postDown()

No description

Details

array getChanges()

Get the changes that have been added on this migration class instance

Return Value

array $changes

getNumChanges()

protected void _addChange(string $type, array $change = array())

Add a change to the stack of changes to execute

Parameters

string $type The type of change
array $change The array of information for the change

Return Value

void

static setDefaultTableOptions(array $options)

Sets the default options for tables created using Doctrine_Migration_Base::createTable()

Parameters

array $options

static array getDefaultTableOptions()

Returns the default options for tables created using Doctrine_Migration_Base::createTable()

Return Value

array

void table(string $upDown, string $tableName, array $fields = array(), array $options = array())

Add a create or drop table change.

Parameters

string $upDown Whether to add the up(create) or down(drop) table change.
string $tableName Name of the table
array $fields Array of fields for table
array $options Array of options for the table

Return Value

void

void createTable(string $tableName, array $fields = array(), array $options = array())

Add a create table change.

Parameters

string $tableName Name of the table
array $fields Array of fields for table
array $options Array of options for the table

Return Value

void

void dropTable(string $tableName)

Add a drop table change.

Parameters

string $tableName Name of the table

Return Value

void

void renameTable(string $oldTableName, string $newTableName)

Add a rename table change

Parameters

string $oldTableName Name of the table to change
string $newTableName Name to change the table to

Return Value

void

void constraint(string $upDown, string $tableName, string $constraintName, array $definition)

Add a create or drop constraint change.

Parameters

string $upDown Whether to add the up(create) or down(drop) create change.
string $tableName Name of the table.
string $constraintName Name of the constraint.
array $definition Array for the constraint definition.

Return Value

void

void createConstraint($tableName, $constraintName, array $definition)

Add a create constraint change.

Parameters

$tableName
$constraintName
array $definition

Return Value

void

void dropConstraint($tableName, $constraintName, $primary = false)

Add a drop constraint change.

Parameters

$tableName
$constraintName
$primary

Return Value

void

void primaryKey(string $direction, string $tableName, string $columnNames)

Convenience method for creating or dropping primary keys.

Parameters

string $direction
string $tableName Name of the table
string $columnNames Array of column names and column definitions

Return Value

void

void createPrimaryKey(string $tableName, string $columnNames)

Convenience method for creating primary keys

[php] $columns = array( 'id' => array( 'type' => 'integer 'autoincrement' => true ) ); $this->createPrimaryKey('my_table', $columns);

Equivalent to doing:

  • Add new columns (addColumn())
  • Create primary constraint on columns (createConstraint())
  • Change autoincrement = true field to be autoincrement

Parameters

string $tableName Name of the table
string $columnNames Array of column names and column definitions

Return Value

void

void dropPrimaryKey(string $tableName, string $columnNames)

Convenience method for dropping primary keys.

[php] $columns = array( 'id' => array( 'type' => 'integer 'autoincrement' => true ) ); $this->dropPrimaryKey('my_table', $columns);

Equivalent to doing:

  • Change autoincrement column so it's not (changeColumn())
  • Remove primary constraint (dropConstraint())
  • Removing columns (removeColumn())

Parameters

string $tableName Name of the table
string $columnNames Array of column names and column definitions

Return Value

void

void foreignKey(string $upDown, string $tableName, string $name, array $definition = array())

Add a create or drop foreign key change.

Parameters

string $upDown Whether to add the up(create) or down(drop) foreign key change.
string $tableName Name of the table.
string $name Name of the foreign key.
array $definition Array for the foreign key definition

Return Value

void

void createForeignKey(string $tableName, string $name, array $definition)

Add a create foreign key change.

Parameters

string $tableName Name of the table.
string $name Name of the foreign key.
array $definition Array for the foreign key definition

Return Value

void

void dropForeignKey(string $tableName, string $name)

Add a drop foreign key change.

Parameters

string $tableName Name of the table.
string $name Name of the foreign key.

Return Value

void

void column(string $upDown, string $tableName, string $columnName, string $type = null, string $length = null, array $options = array())

Add a add or remove column change.

Parameters

string $upDown Whether to add the up(add) or down(remove) column change.
string $tableName Name of the table
string $columnName Name of the column
string $type Type of the column
string $length Length of the column
array $options Array of options for the column

Return Value

void

void addColumn(string $tableName, string $columnName, string $type, string $length = null, array $options = array())

Add a add column change.

Parameters

string $tableName Name of the table
string $columnName Name of the column
string $type Type of the column
string $length Length of the column
array $options Array of options for the column

Return Value

void

void removeColumn(string $tableName, string $columnName)

Add a remove column change.

Parameters

string $tableName Name of the table
string $columnName Name of the column

Return Value

void

void renameColumn(string $tableName, string $oldColumnName, string $newColumnName)

Add a rename column change

Parameters

string $tableName Name of the table to rename the column on
string $oldColumnName The old column name
string $newColumnName The new column name

Return Value

void

void changeColumn(string $tableName, string $columnName, string $type = null, string $length = null, array $options = array())

Add a change column change

Parameters

string $tableName Name of the table to change the column on
string $columnName Name of the column to change
string $type New type of column
string $length The length of the column
array $options New options for the column

Return Value

void

void index(string $upDown, string $tableName, string $indexName, array $definition = array())

Add a add or remove index change.

Parameters

string $upDown Whether to add the up(add) or down(remove) index change.
string $tableName Name of the table
string $indexName Name of the index
array $definition Array for the index definition

Return Value

void

void addIndex(string $tableName, string $indexName, array $definition)

Add a add index change.

Parameters

string $tableName Name of the table
string $indexName Name of the index
array $definition Array for the index definition

Return Value

void

void removeIndex(string $tableName, string $indexName)

Add a remove index change.

Parameters

string $tableName Name of the table
string $indexName Name of the index

Return Value

void

preUp()

postUp()

preDown()

postDown()