frubalu
09/13/2021, 5:08 PMcategories
table, however it isn't deleting due to a foreign key constraint. I have a join table named category_items
, which is where it's failing. How can I alter the table to allow for a ON DELETE CASCADE
? I'm looking to automatically delete entries from category_items
whenever attempting to delete an entry from categories
.frubalu
09/13/2021, 6:10 PMburggraf
09/14/2021, 12:18 AMfrubalu
09/14/2021, 3:03 PMALTER TABLE category_items
DROP CONSTRAINT category_items_category_id_fkey,
ADD CONSTRAINT category_items_category_id_fkey
FOREIGN KEY (id)
REFERENCES categories(id)
ON UPDATE CASCADE
ON DELETE CASCADE;
however Supabase returns the error:
insert or update on table "category_items" violates foreign key constraint "category_items_category_id_fkey"