diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-06-03 12:49:35 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-06-03 12:49:35 +0530 |
| commit | 5993ea8f6fd4316aee313e1e6fdae2dc7fbab5df (patch) | |
| tree | a71b605a3e6d53158ca866fb30c76a0d0601357f /setup.sql | |
| parent | 8c62edb87433bd0ac93fdef4585582990513236b (diff) | |
| download | sqlite-creative-coding-5993ea8f6fd4316aee313e1e6fdae2dc7fbab5df.tar.gz sqlite-creative-coding-5993ea8f6fd4316aee313e1e6fdae2dc7fbab5df.zip | |
Add circle example
Diffstat (limited to '')
| -rw-r--r-- | setup.sql | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -18,3 +18,10 @@ CREATE TABLE pixels ( FOREIGN KEY(image_id) REFERENCES images(id), UNIQUE(image_id, x, y) ); + +CREATE TRIGGER delete_pixels_when_image_deleted +AFTER DELETE ON images +WHEN (SELECT COUNT(*) FROM images WHERE id = OLD.id) = 0 +BEGIN + DELETE FROM pixels WHERE image_id = OLD.id; +END; |
