-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow setting the
ON DELETE
behaviour of foreign key constraints (#297
) Add support for setting the `ON DELETE` behaviour of a foreign key constraint. An example migration that uses the behaviour is: ```json { "name": "21_add_foreign_key_constraint", "operations": [ { "alter_column": { "table": "posts", "column": "user_id", "references": { "name": "fk_users_id", "table": "users", "column": "id", "on_delete": "CASCADE" }, "up": "(SELECT CASE WHEN EXISTS (SELECT 1 FROM users WHERE users.id = user_id) THEN user_id ELSE NULL END)", "down": "user_id" } } ] } ``` The valid options for `on_delete` are `CASCADE`, `SET NULL`, `RESTRICT`, or `NO ACTION`. If the field is omitted, the default is `NO ACTION`, Fixes #221
- Loading branch information
1 parent
431b951
commit def08e2
Showing
8 changed files
with
578 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.