Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julioz/89b8bc017523fe71c2198b0562444321 to your computer and use it in GitHub Desktop.
Save julioz/89b8bc017523fe71c2198b0562444321 to your computer and use it in GitHub Desktop.
Example of foreign key cascade action
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