Created
June 30, 2020 15:49
-
-
Save julioz/89b8bc017523fe71c2198b0562444321 to your computer and use it in GitHub Desktop.
Example of foreign key cascade action
This file contains hidden or 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
CREATE TABLE IF NOT EXISTS TrackCreator ( | |
`track_id` TEXT NOT NULL, | |
`user_id` TEXT NOT NULL, | |
PRIMARY KEY(`track_id`, `user_id`), | |
FOREIGN KEY(`track_id`) REFERENCES `Track`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , | |
FOREIGN KEY(`user_id`) REFERENCES `User`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment