Add ON DELETE CASCADE To Foreign Key Constraint
begin;
alter table orders
drop constraint orders_customer_id_fkey;
alter table orders
add constraint orders_customer_id_fkey
foreign key (customer_id)
references customers (id)
on delete cascade;
commit;Last updated