Exec
Exec
Represents a migration action that executes one or more raw SQL statements.
class Exec extends \Hazaar\DBI\Manager\Migration\Action\BaseActionExtends: Hazaar\DBI\Manager\Migration\Action\BaseAction
Used to run arbitrary SQL during a migration when the higher-level table, index, function (etc.) actions are not expressive enough (data back-fills, ad-hoc DDL, vendor specific statements and so on).
Properties
statements
The list of raw SQL statements to execute, in order.
public array $statementsType: array
Methods
construct
Initializes the exec action from the provided data.
public construct(mixed $data): voidReturns: void
The exec key may be a single SQL statement string or an array of statements that are executed sequentially.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | The data to initialize the statements from. Modified by reference. |
run
Executes the raw SQL statements against the database.
public run(Adapter $dbi, ActionType $type, ActionName $name, ?string $user): boolReturns: bool
Statements are run in the order they were defined. Execution stops at the first statement that fails.
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Hazaar\DBI\Adapter | the database adapter instance |
$type | Hazaar\DBI\Manager\Migration\Enum\ActionType | not used for exec actions, but included for consistency with other actions |
$name | Hazaar\DBI\Manager\Migration\Enum\ActionName | not used for exec actions, but included for consistency with other actions |
$user | string | not used for exec actions, but included for consistency with other actions |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000