Properties

$name

$name : string

The name of the current table

Type

string

$table_options

$table_options : array

Options for the current table

Type

array

$columns

$columns : array

Columns to be added/updated for the current table

Type

array

$indexes

$indexes : array

Indexes to be added/updated for the current table

Type

array

$foreign_keys

$foreign_keys : array

Foreign keys to be added/updated for the current table

Type

array

Methods

add_column()

add_column(string $column_name, string $type, array $options) : \Query\Table\Table_Builder

Add a column to the current table

Parameters

string $column_name
string $type
array $options

Returns

\Query\Table\Table_Builder

remove_column()

remove_column(string $column_name) : \Query\Table\Table_Builder

Remove the specified column name from the current table

Parameters

string $column_name

Returns

\Query\Table\Table_Builder

rename_column()

rename_column(string $old_name, string $new_name) : \Query\Table\Table_Builder

Rename the specified column on the current table

Parameters

string $old_name
string $new_name

Returns

\Query\Table\Table_Builder

change_column()

change_column(string $column_name, string $new_column_type, array $options) : \Query\Table\Table_Builder

Change the specified column on the current table

Parameters

string $column_name
string $new_column_type
array $options

Returns

\Query\Table\Table_Builder

has_column()

has_column(string $column_name, array $options) : bool

Determine whether the column currently exists on the current table

Parameters

string $column_name
array $options

Returns

bool

add_index()

add_index(array $columns, array $options) : \Query\Table\Table_Builder

Add an index to the current table

Parameters

array $columns
array $options

Returns

\Query\Table\Table_Builder

remove_index()

remove_index(array $columns, array $options) : \Query\Table\Table_Builder

Remove an index from the current table

Parameters

array $columns
array $options

Returns

\Query\Table\Table_Builder

remove_index_by_name()

remove_index_by_name(string $name) : \Query\Table\Table_Builder

Remove an index by its name from the current table

Parameters

string $name

Returns

\Query\Table\Table_Builder

has_index()

has_index(array $columns, array $options) : bool

Check if the current table has an index on the specified columns

Parameters

array $columns
array $options

Returns

bool

add_foreign_key()

add_foreign_key(array $columns, string $referenced_table, array $referenced_columns, array $options) : \Query\Table\Table_Builder

Add a foreign key to the current table

Parameters

array $columns
string $referenced_table
array $referenced_columns
array $options

Returns

\Query\Table\Table_Builder

drop_foreign_key()

drop_foreign_key(array $columns, string $constraint) : \Query\Table\Table_Builder

Drop the foreign key from the current table

Parameters

array $columns
string $constraint

Returns

\Query\Table\Table_Builder

has_foreign_key()

has_foreign_key(array $columns, string $constraint) : bool

Determine whether the current table has the specified foreign key

Parameters

array $columns
string $constraint

Returns

bool

exists()

exists() : bool

Check whether the current table exists

Returns

bool

drop()

drop() : void

Drop the current table

rename()

rename(string $new_table_name) : void

Rename the current table

Parameters

string $new_table_name

get_columns()

get_columns() : array

Get the list of columns for the current table

Returns

array

create()

create() : void

Create the table from the previously set options

update()

update() : void

Update the current table with the changes made

save()

save() : void

Save the changes made to the table

reset()

reset() : void

Reset the state of the table builder