Table
Less than 1 minute
Table
Represents a database table for migration actions.
class Table extends \Hazaar\DBI\Manager\Migration\Action\BaseActionEncapsulates table attributes such as name and columns, and provides methods for creating, altering, dropping, applying, diffing, and reversing table schema changes in migration processes.
Properties
name
The name of the table.
public string $namecolumns
public array $columnsadd
public array $addalter
public array $alterMethods
create
Creates the table in the database.
public create(Adapter $dbi): boolValidates required properties and logs errors if missing. Converts columns to arrays for creation.
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter | the database adapter instance |
alter
public alter(Adapter $dbi): boolParameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter |
drop
public drop(Adapter $dbi): boolParameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter |
apply
Applies the given action to the table.
public apply(BaseAction $action): boolThis method processes the action by adding, altering, or dropping columns based on the properties of the provided BaseAction object.
Parameters
| Parameter | Type | Description |
|---|---|---|
$action | BaseAction | The action to be applied. It may contain 'add', 'alter', and 'drop' properties. - 'add': An array of columns to be added. - 'alter': An array of columns to be altered. - 'drop': An array of column names to be dropped. |
diff
public diff(BaseAction $table): ?selfParameters
| Parameter | Type | Description |
|---|---|---|
$table | BaseAction |
reverse
public reverse(self $sourceTable): selfParameters
| Parameter | Type | Description |
|---|---|---|
$sourceTable | self |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000