From 9b4106568cccde7d7f8f73ff7fb709f46590771d Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 4 Mar 2022 20:26:27 +0000 Subject: [PATCH] make the foreign key constraint "on delete cascade" --- sql/schema/init.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/schema/init.sql b/sql/schema/init.sql index 3eed88d..66daf0c 100644 --- a/sql/schema/init.sql +++ b/sql/schema/init.sql @@ -11,7 +11,9 @@ create table shopping_lists( create table shopping_list_items( id bigserial primary key, - shopping_list bigint not null references shopping_lists(id), + shopping_list bigint not null + references shopping_lists(id) + on delete cascade, description text not null, version bigint not null default 1, done boolean not null default false ); -- 2.39.5