Interface TableSchemaInterface

An interface used by database TableSchema objects.

Cake\Database\Schema\TableSchemaInterface implements Cake\Datasource\SchemaInterface

Direct Implementers

Constants summary

Method Summary

Method Detail

addConstraint()source 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()source 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()source public

constraints( )

Get the names of all the constraints in the table.

Returns

array

dropConstraint()source public

dropConstraint( string $name )

Remove a constraint.

Parameters

string $name
Name of the constraint to remove

Returns


$this

getConstraint()source public

getConstraint( string $name )

Read information about a constraint based on name.

Parameters

string $name
The name of the constraint.

Returns

array|null
Array of constraint data, or null

getIndex()source public

getIndex( string $name )

Read information about an index based on name.

Parameters

string $name
The name of the index.

Returns

array|null
Array of index data, or null

hasAutoincrement()source public

hasAutoincrement( )

Check whether or not a table has an autoIncrement column defined.

Returns

boolean

indexes()source public

indexes( )

Get the names of all the indexes in the table.

Returns

array

isTemporary()source public

isTemporary( )

Gets whether the table is temporary in the database.

Returns

boolean
The current temporary setting.

primaryKey()source public

primaryKey( )

Get the column(s) used for the primary key.

Returns

array

Column name(s) for the primary key. An empty list will be returned when the table has no primary key.


setTemporary()source 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

© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.Database.Schema.TableSchemaInterface.html