TableDefinition
extends DefinitionPart
in package
Class TableDefinition.
Table of Contents
- $checks : array<string|int, mixed>
- $columns : array<string|int, mixed>
- $condition : string|null
- $database : Database
- $indexes : array<string|int, mixed>
- __call() : mixed
- __construct() : mixed
- TableDefinition constructor.
- check() : Check
- Adds a check constraint to the Table Definition list.
- column() : ColumnDefinition
- Adds a column to the Table Definition list.
- index() : IndexDefinition
- Adds an index to the Table Definition list.
- renderChecks() : string
- renderColumns() : string
- renderIndexes() : string
- sql() : string
Properties
$checks
protected
array<string|int, mixed>
$checks
= []
$columns
protected
array<string|int, mixed>
$columns
= []
$condition
protected
string|null
$condition
= null
$database
protected
Database
$database
$indexes
protected
array<string|int, mixed>
$indexes
= []
Methods
__call()
public
__call(string $method, array<int, mixed> $arguments) : mixed
Parameters
- $method : string
- $arguments : array<int, mixed>
Return values
mixed —__construct()
TableDefinition constructor.
public
__construct(Database $database[, string|null $condition = null ]) : mixed
Parameters
- $database : Database
- $condition : string|null = null
Return values
mixed —check()
Adds a check constraint to the Table Definition list.
public
check(Closure $expression) : Check
Parameters
- $expression : Closure
-
Must return a string with the check expression. The function receives a Database instance in the first parameter.
Return values
Check —column()
Adds a column to the Table Definition list.
public
column(string $name[, string|null $changeName = null ]) : ColumnDefinition
Parameters
- $name : string
-
Column name
- $changeName : string|null = null
-
New column name. Used on ALTER TABLE CHANGE
Return values
ColumnDefinition —index()
Adds an index to the Table Definition list.
public
index([string|null $name = null ]) : IndexDefinition
Parameters
- $name : string|null = null
-
Index name
Return values
IndexDefinition —renderChecks()
protected
renderChecks() : string
Return values
string —renderColumns()
protected
renderColumns([string|null $prefix = null ]) : string
Parameters
- $prefix : string|null = null
Return values
string —renderIndexes()
protected
renderIndexes([string|null $prefix = null ]) : string
Parameters
- $prefix : string|null = null
Return values
string —sql()
protected
sql([string|null $prefix = null ]) : string
Parameters
- $prefix : string|null = null