Constraint
Constraint
Represents a database constraint for migration actions.
class Constraint extends \Hazaar\DBI\Manager\Migration\Action\BaseActionEncapsulates constraint attributes such as name, table, type, columns, and references. Provides methods for creating, altering, dropping, and serializing constraints in migration processes.
Properties
name
The name of the constraint.
public string $nametable
The name of the table the constraint applies to.
public string $tabletype
The type of the constraint (e.g., PRIMARY, FOREIGN, UNIQUE).
public string $typecolumn
The columns involved in the constraint.
public array $columnreferences
The reference information for foreign key constraints.
public ConstraintReference $referencesMethods
construct
Initializes the constraint from the provided data.
public construct(mixed $data): voidIf the 'column' value is not an array, it is converted to an array.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | The data to initialize the constraint from. Modified by reference. |
create
Creates the constraint in the database.
public create(Adapter $dbi): boolParameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter | the database adapter instance |
alter
Alters the constraint in the database.
public alter(Adapter $dbi): boolParameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter | the database adapter instance |
drop
Drops the constraint from the database.
public drop(Adapter $dbi): boolParameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Adapter | the database adapter instance |
serializeDrop
Serializes the constraint for drop operations.
public serializeDrop(): mixedGenerated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000