Skip to content

Kirby 4.3.0


Creates the CREATE TABLE syntax for a single column

$sql->createColumn(string $name, array $column): array


Name Type Default Description
$name * string Column name
$column * array Column definition array; valid keys:
- type (required): Column template to use
- unsigned: Whether an int column is signed or unsigned (boolean)
- size: The size of varchar (int)
- precision: The precision of a decimal type
- decimalPlaces: The number of decimal places for a decimal type
- null: Whether the column may be NULL (boolean)
- key: Index this column is part of; special values 'primary' for PRIMARY KEY and true for automatic naming
- unique: Whether the index (or if not set the column itself) has a UNIQUE constraint
- default: Default value of this column

Return type



Type Description
Kirby\Exception\InvalidArgumentException if no column type is given or the column type is not supported.

Parent class