Propagating changes
- Enable
PRAGMA foreign_keys = ON
- Add
k PRIMARY KEY
to the parent tablet
1 - Add
FOREIGN KEY(k) REFERENCES t(k)
to the child table Optionally specify
FOREIGN KEY … ON DELETE action
FOREIGN KEY … ON UPDATE action
with
action
being one of:RESTRICT
SET NULL
SET DEFAULT
CASCADE
Footnotes:
1
The parent column must be PRIMARY KEY
, or “foreign key mismatch” error is shown.