packages/sql-semantics-sqlite/src/Statement/Schema/Reference/ReferenceEvent.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\Sqlite\Statement\Schema\Reference;
6
7/**
8 * The change of a parent key a foreign key action is written for.
9 *
10 * The grammar also accepts ON INSERT; SQLite reads it and attaches no action to it.
11 * Source: https://sqlite.org/foreignkeys.html#fk_actions.
12 *
13 * @visibility public
14 * @example Reading the event of a foreign key action
15 * $create = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('CREATE TABLE c (p REFERENCES parent ON DELETE CASCADE)');
16 * $create->statement->columns[0]->constraints[0]->arguments[0]->event // => \SqlSemantics\Platform\Sqlite\Statement\Schema\Reference\ReferenceEvent::Delete
17 */
18enum ReferenceEvent: string
19{
20 case Insert = 'INSERT';
21 case Delete = 'DELETE';
22 case Update = 'UPDATE';
23}
24