$name
$name : string
This object is based loosely on: http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Table.html.
$adapter : \Phinx\Db\Adapter\AdapterInterface
$foreignKeys : array<mixed,\Phinx\Db\Table\ForeignKey>
__construct(string $name, array $options = array(), \Phinx\Db\Adapter\AdapterInterface $adapter = null)
Class Constuctor.
| string | $name | Table Name |
| array | $options | Options |
| \Phinx\Db\Adapter\AdapterInterface | $adapter | Database Adapter |
setName(string $name) : \Phinx\Db\Table
Sets the table name.
| string | $name | Table Name |
setOptions(array $options) : \Phinx\Db\Table
Sets the table options.
| array | $options |
setAdapter(\Phinx\Db\Adapter\AdapterInterface $adapter) : \Phinx\Db\Table
Sets the database adapter.
| \Phinx\Db\Adapter\AdapterInterface | $adapter | Database Adapter |
getAdapter() : \Phinx\Db\Adapter\AdapterInterface
Gets the database adapter.
rename(string $newTableName) : \Phinx\Db\Table
Renames the database table.
| string | $newTableName | New Table Name |
setColumns(array $columns) : \Phinx\Db\Table
Sets an array of columns waiting to be committed.
Use setPendingColumns
| array | $columns | Columns |
getColumns() : array<mixed,\Phinx\Db\Table\Column>
Gets an array of the table columns.
| None found |
setPendingColumns(array $columns) : \Phinx\Db\Table
Sets an array of columns waiting to be committed.
| array | $columns | Columns |
| None found |
getPendingColumns() : array<mixed,\Phinx\Db\Table\Column>
Gets an array of columns waiting to be committed.
| None found |
setIndexes(array $indexes) : \Phinx\Db\Table
Sets an array of columns waiting to be indexed.
| array | $indexes | Indexes |
| None found |
| None found |
setForeignKeys(array<mixed,\Phinx\Db\Table\ForeignKey> $foreignKeys) : \Phinx\Db\Table
Sets an array of foreign keys waiting to be commited.
| array<mixed,\Phinx\Db\Table\ForeignKey> | $foreignKeys | foreign keys |
| None found |
getForeignKeys() : array|array<mixed,\Phinx\Db\Table\ForeignKey>
Gets an array of foreign keys waiting to be commited.
| None found |
setData(array $data) : \Phinx\Db\Table
Sets an array of data to be inserted.
| array | $data | Data |
| None found |
| None found |
| None found |
addColumn(\Phinx\Db\Table\Column|string $columnName, null $type = null, array $options = array()) : \Phinx\Db\Table|\think\migration\db\Table
Add a table column.
Type can be: string, text, integer, float, decimal, datetime, timestamp, time, date, binary, boolean.
Valid options can be: limit, default, null, precision or scale.
| \Phinx\Db\Table\Column|string | $columnName | Column Name |
| null | $type | Column Type |
| array | $options | Column Options |
| None found |
removeColumn(string $columnName) : \Phinx\Db\Table
Remove a table column.
| string | $columnName | Column Name |
| None found |
renameColumn(string $oldName, string $newName) : \Phinx\Db\Table
Rename a table column.
| string | $oldName | Old Column Name |
| string | $newName | New Column Name |
| None found |
changeColumn(string $columnName, null $newColumnType = null, array $options = array()) : \Phinx\Db\Table|\think\migration\db\Table
Change a table column type.
| string | $columnName | Column Name |
| null | $newColumnType | New Column Type |
| array | $options | Options |
| None found |
hasColumn(string $columnName, array $options = array()) : boolean
Checks to see if a column exists.
| string | $columnName | Column Name |
| array | $options | Options |
| None found |
addIndex(string|array|\Phinx\Db\Table\Index $columns, array $options = array()) : \Phinx\Db\Table
Add an index to a database table.
In $options you can specific unique = true/false or name (index name).
| string|array|\Phinx\Db\Table\Index | $columns | Table Column(s) |
| array | $options | Index Options |
| None found |
removeIndex(array $columns, array $options = array()) : \Phinx\Db\Table
Removes the given index from a table.
| array | $columns | Columns |
| array | $options | Options |
| None found |
removeIndexByName(string $name) : \Phinx\Db\Table
Removes the given index identified by its name from a table.
| string | $name | Index name |
| None found |
hasIndex(string|array $columns, array $options = array()) : boolean
Checks to see if an index exists.
| string|array | $columns | Columns |
| array | $options | Options |
| None found |
addForeignKey(string|array $columns, string|\Phinx\Db\Table $referencedTable, string|array $referencedColumns = array('id'), array $options = array()) : \Phinx\Db\Table
Add a foreign key to a database table.
In $options you can specify on_delete|on_delete = cascade|no_action .., on_update, constraint = constraint name.
| string|array | $columns | Columns |
| string|\Phinx\Db\Table | $referencedTable | Referenced Table |
| string|array | $referencedColumns | Referenced Columns |
| array | $options | Options |
| None found |
dropForeignKey(string|array $columns, null|string $constraint = null) : \Phinx\Db\Table
Removes the given foreign key from the table.
| string|array | $columns | Column(s) |
| null|string | $constraint | Constraint names |
| None found |
hasForeignKey(string|array $columns, null|string $constraint = null) : boolean
Checks to see if a foreign key exists.
| string|array | $columns | Column(s) |
| null|string | $constraint | Constraint names |
| None found |
addTimestamps(string $createdAtColumnName = 'create_time', string $updatedAtColumnName = 'update_time') : \Phinx\Db\Table|\think\migration\db\Table
Add timestamp columns created_at and updated_at to the table.
| string | $createdAtColumnName | |
| string | $updatedAtColumnName |
| None found |
insert( $data) : \Phinx\Db\Table
Insert data into the table.
| $data | array of data in the form: array( array("col1" => "value1", "col2" => "anotherValue1"), array("col2" => "value2", "col2" => "anotherValue2"), ) or array("col1" => "value1", "col2" => "anotherValue1") |
| None found |
| None found |
| None found |
| None found |
save() : void
Commits the table changes.
If the table doesn't exist it is created otherwise it is updated.
| None found |
| None found |
| None found |
| None found |
| None found |
| None found |
| None found |
| None found |
| None found |