You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`->forEachRow()`| The trigger will be called for every row. |
272
-
|`->forEachStatement()`| The trigger will be called once for each statement *(default)*. |
273
-
|`->transitionTables(`<br>` old: 'oldrows',`<br>` new: 'newrows',`<br>`)`| The forEachStatement-trigger will provide the before/after state of the affected rows in special tables. You can omit either option if not valid for this trigger. |
274
-
|`->when('NEW.type = 4')`<br>`->when(fn ($query) => $query->where('NEW.type', 4))`| The trigger should only be called when the condition matches *(only with forEachRow)*. |
275
-
|`->replace(true)`| The trigger will replace an existing one defined with the same name. |
|`->forEachRow()`| The trigger will be called for every row. |
272
+
|`->forEachStatement()`| The trigger will be called once for each statement *(default)*. |
273
+
|`->transitionTables(`<br>` old: 'oldrows',`<br>` new: 'newrows',`<br>`)`| The forEachStatement-trigger will provide the before/after state of the affected rows in special tables. You can omit either option if not valid for this trigger. |
274
+
|`->whenCondition('NEW.type = 4')`<br>`->whenCondition(fn ($query) => $query->where('NEW.type', 4))`| The trigger should only be called when the condition matches *(only with forEachRow)*. |
275
+
|`->replace(true)`| The trigger will replace an existing one defined with the same name. |
276
276
277
277
> [!NOTE]
278
278
> PostgreSQL always updates rows even if nothing changed, which may affect your performance. You can add the `suppress_redundant_updates_trigger()` trigger with a `BEFORE UPDATE` action to all tables.
$this->assertEquals(['create trigger "noop_274029" after insert on "example" for each row when (NEW."id" = 42) execute function noop()'], array_column($queries, 'query'));
@@ -122,7 +122,7 @@ public function testCreateTriggerWhenSql(): void
122
122
Schema::table('example', function (Blueprint$table): void {
$this->assertEquals(['create trigger "noop_274029" after delete on "example" for each row when (OLD.id = 0815) execute function noop()'], array_column($queries, 'query'));
0 commit comments