Interface TableSchemaInterface
An interface used by database TableSchema objects.
Deprecated 3.5.0: Use Cake\Database\TableSchemaAwareInterface instead.
- Cake\Database\Schema\TableSchemaInterface implements Cake\Datasource\SchemaInterface
Direct Implementers
Constants summary
Method Summary
-
addConstraint() public
Add a constraint. -
addIndex() public
Add an index. -
constraints() public
Get the names of all the constraints in the table. -
dropConstraint() public
Remove a constraint. -
getConstraint() public
Read information about a constraint based on name. -
getIndex() public
Read information about an index based on name. -
hasAutoincrement() public
Check whether or not a table has an autoIncrement column defined. -
indexes() public
Get the names of all the indexes in the table. -
isTemporary() public
Gets whether the table is temporary in the database. -
primaryKey() public
Get the column(s) used for the primary key. -
setTemporary() public
Sets whether the table is temporary in the database.
Method Detail
addConstraint() public ¶
addConstraint( string $name , array $attrs )
Add a constraint.
Used to add constraints to a table. For example primary keys, unique keys and foreign keys.
Attributes
type
The type of constraint being added.columns
The columns in the index.references
The table, column a foreign key references.update
The behavior on update. Options are 'restrict', 'setNull', 'cascade', 'noAction'.delete
The behavior on delete. Options are 'restrict', 'setNull', 'cascade', 'noAction'.
The default for 'update' & 'delete' is 'cascade'.
Parameters
- string $name
- The name of the constraint.
- array $attrs
- The attributes for the constraint.
Returns
$this
addIndex() public ¶
addIndex( string $name , array $attrs )
Add an index.
Used to add indexes, and full text indexes in platforms that support them.
Attributes
type
The type of index being added.columns
The columns in the index.
Parameters
- string $name
- The name of the index.
- array $attrs
- The attributes for the index.
Returns
$this
constraints() public ¶
constraints( )
Get the names of all the constraints in the table.
Returns
dropConstraint() public ¶
dropConstraint( string $name )
Remove a constraint.
Parameters
- string $name
- Name of the constraint to remove
Returns
$this
getConstraint() public ¶
getConstraint( string $name )
Read information about a constraint based on name.
Parameters
- string $name
- The name of the constraint.
Returns
Array of constraint data, or null
getIndex() public ¶
getIndex( string $name )
Read information about an index based on name.
Parameters
- string $name
- The name of the index.
Returns
Array of index data, or null
hasAutoincrement() public ¶
hasAutoincrement( )
Check whether or not a table has an autoIncrement column defined.
Returns
isTemporary() public ¶
isTemporary( )
Gets whether the table is temporary in the database.
Returns
The current temporary setting.
primaryKey() public ¶
primaryKey( )
Get the column(s) used for the primary key.
Returns
Column name(s) for the primary key. An empty list will be returned when the table has no primary key.
setTemporary() public ¶
setTemporary( boolean $temporary )
Sets whether the table is temporary in the database.
Parameters
- boolean $temporary
- Whether or not the table is to be temporary.
Returns
$this