diff --git a/migrations/0108.sql b/migrations/0108.sql new file mode 100644 index 00000000..d4d64a08 --- /dev/null +++ b/migrations/0108.sql @@ -0,0 +1,10 @@ +DELETE +FROM shopping_list +WHERE shopping_list_id NOT IN (SELECT id FROM shopping_lists); + +CREATE TRIGGER remove_items_from_deleted_shopping_list + AFTER DELETE + ON shopping_lists +BEGIN + DELETE FROM shopping_list WHERE shopping_list_id = OLD.id; +END; \ No newline at end of file