BaseAction
BaseAction
Abstract base class for migration actions.
class BaseAction extends \Hazaar\DBI\Manager\Migration\Action\Struct implements \Hazaar\DBI\Manager\Migration\Action\SpecProvides a framework for implementing database migration actions such as create, alter, and drop. Subclasses should override the action methods to provide specific logic for each migration step. Implements the Spec interface for migration specifications.
Properties
drop
public array $dropMethods
construct
Initializes the action from the provided data.
public construct(mixed $data): voidIf the data does not contain 'name' or 'drop' and is not an associative array, it is treated as a drop list.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | The data to initialize the action from. Modified by reference. |
run
Executes the migration action based on the specified type and name.
public run(Adapter $dbi, ActionType $type, ActionName $name): boolDispatches to the appropriate method (create, alter, drop) depending on the action name.
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter | the database adapter instance |
$type | ActionType | the type of migration action |
$name | ActionName | the name of the migration action (CREATE, ALTER, DROP) |
create
Performs the CREATE migration action.
public create(Adapter $dbi): boolOverride in subclasses to implement creation logic for the database object.
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter | the database adapter instance |
alter
Performs the ALTER migration action.
public alter(Adapter $dbi): boolOverride in subclasses to implement alteration logic for the database object.
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter | the database adapter instance |
drop
Performs the DROP migration action.
public drop(Adapter $dbi): boolOverride in subclasses to implement drop logic for the database object.
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter | the database adapter instance |
apply
Apply an ALTER action to the BaseAction.
public apply(self $action): boolParameters
| Parameter | Type | Description |
|---|---|---|
$action | self |
diff
Find the difference between two BaseActions.
public diff(self $action): ?selfParameters
| Parameter | Type | Description |
|---|---|---|
$action | self |
serializeDrop
Return the BaseAction as an array.
public serializeDrop(): mixedGenerated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000