Trigger
About 1 min
Trigger
Trait Trigger.
trait TriggerProvides methods for managing and interacting with SQL triggers in the database. Includes listing, checking existence, describing, creating, and dropping triggers. Intended for use in DBI adapters supporting SQL trigger operations.
Methods
listTriggers
List defined triggers in the current schema, optionally filtered by table name.
public listTriggers(?string $tableName): voidParameters
| Parameter | Type | Description |
|---|---|---|
$tableName | string | optional table name to filter triggers |
triggerExists
Check if a trigger exists on a given table.
public triggerExists(string $triggerName, string $tableName): boolParameters
| Parameter | Type | Description |
|---|---|---|
$triggerName | string | the name of the trigger to check for existence |
$tableName | string | the name of the table to check for the trigger |
describeTrigger
Describe a database trigger, including its events, table, body, orientation, and timing.
public describeTrigger(string $triggerName, ?string $schemaName, false $): voidParameters
| Parameter | Type | Description |
|---|---|---|
$triggerName | string | the name of the trigger to describe |
$schemaName | string | Optional schema name. If not supplied, uses the current schema. |
$ | false |
createTrigger
Create a new trigger on a table.
public createTrigger(string $triggerName, string $tableName, mixed $spec): boolParameters
| Parameter | Type | Description |
|---|---|---|
$triggerName | string | the name of the trigger to create |
$tableName | string | the table on which the trigger is being created |
$spec | mixed | the specification of the trigger, typically the array returned from describeTrigger() |
dropTrigger
Drop a trigger from a table.
public dropTrigger(string $triggerName, string $tableName, bool $cascade, bool $ifExists): boolParameters
| Parameter | Type | Description |
|---|---|---|
$triggerName | string | the name of the trigger to remove |
$tableName | string | the name of the table to remove the trigger from |
$cascade | bool | whether to drop CASCADE |
$ifExists | bool | if true, only drops the trigger if it exists |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000