TYPE_BINARY
TYPE_BINARY = 'binary' : string
Binary column type
An interface used by database TableSchema objects.
Deprecated 3.5.0: Use Cake\Database\TableSchemaAwareInterface instead.
addColumn(string $name, array|string $attrs) : $this
Add a column to the table.
Columns can have several attributes:
type
The type of the column. This should be
one of CakePHP's abstract types.length
The length of the column.precision
The number of decimal places to store
for float and decimal types.default
The default value of the column.null
Whether or not the column can hold nulls.fixed
Whether or not the column is a fixed length column.
This is only present/valid with string columns.unsigned
Whether or not the column is an unsigned column.
This is only present/valid for integer, decimal, float columns.In addition to the above keys, the following keys are implemented in some database dialects, but not all:
comment
The comment for the column.string | $name | The name of the column |
array|string | $attrs | The attributes for the column. |
addIndex(string $name, array $attrs) : $this
Add an index.
Used to add indexes, and full text indexes in platforms that support them.
type
The type of index being added.columns
The columns in the index.string | $name | The name of the index. |
array | $attrs | The attributes for the index. |
addConstraint(string $name, array $attrs) : $this
Add a constraint.
Used to add constraints to a table. For example primary keys, unique keys and foreign keys.
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'.
string | $name | The name of the constraint. |
array | $attrs | The attributes for the constraint. |