Migration
Migration
Represents a database migration, including events and metadata.
class Migration extends \Hazaar\Model\StructExtends: Hazaar\Model\Struct
Encapsulates migration message, requirements, execution steps, and up/down events for schema changes.
Properties
message
The message describing the migration.
public string $messageType: string
raise
Raises an exception if the migration is not compatible with the current database schema.
public string $raiseType: string
requires
List of migration versions that are required to be run before this migration.
public array $requiresType: array
exec
public array $execType: array
up
The event to run when applying the migration (up direction).
public Event $upType: Hazaar\DBI\Manager\Migration\Event
down
The event to run when rolling back the migration (down direction).
public Event $downType: Hazaar\DBI\Manager\Migration\Event
Methods
replay
Applies the migration by running the 'up' event.
public replay(Adapter $dbi): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Hazaar\DBI\Adapter | the database adapter instance |
rollback
Rolls back the migration by running the 'down' event.
public rollback(Adapter $dbi): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Hazaar\DBI\Adapter | the database adapter instance |
grant
public grant(?string $user): selfReturns: self
Parameters
| Parameter | Type | Description |
|---|---|---|
$user | string |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000