diff --git a/db/constraints.sql b/db/constraints.sql index e5d2cb3d4d..434662fdff 100644 --- a/db/constraints.sql +++ b/db/constraints.sql @@ -193,7 +193,9 @@ alter table consent alter table consent add foreign key(consent_type_id) references consent_type(id) - on update cascade; + on update cascade + on delete restrict; + -- explicit delete restrict on this foreign key alter table consent_type add index consent_name(shortname); diff --git a/html/ops/db_update.php b/html/ops/db_update.php index 5e5bf7356c..8bf58e9189 100644 --- a/html/ops/db_update.php +++ b/html/ops/db_update.php @@ -1200,7 +1200,8 @@ function update_9_12_2018() { do_query("alter table consent add foreign key(consent_type_id) references consent_type(id) - on update cascade; + on update cascade + on delete restrict; "); do_query("insert into consent_type