From 09aca0a85d553a1b2b1052bbba0c3bedacc36886 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Wed, 18 Dec 2024 18:00:44 +0545 Subject: [PATCH] permission: cascade delete --- schema/permissions.hcl | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/schema/permissions.hcl b/schema/permissions.hcl index 535fb50c..65b52d86 100644 --- a/schema/permissions.hcl +++ b/schema/permissions.hcl @@ -102,57 +102,55 @@ table "permissions" { columns = [column.playbook_id] ref_columns = [table.playbooks.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } - foreign_key "permissions_canary_id_fkey" { columns = [column.canary_id] ref_columns = [table.canaries.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } foreign_key "permissions_component_id_fkey" { columns = [column.component_id] ref_columns = [table.components.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } foreign_key "permissions_connection_id_fkey" { columns = [column.connection_id] ref_columns = [table.connections.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } foreign_key "permissions_config_id_fkey" { columns = [column.config_id] ref_columns = [table.config_items.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } foreign_key "permissions_created_by_fkey" { columns = [column.created_by] ref_columns = [table.people.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } foreign_key "permissions_notification_fkey" { columns = [column.notification_id] ref_columns = [table.notifications.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } foreign_key "permissions_person_fkey" { columns = [column.person_id] ref_columns = [table.people.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } - foreign_key "permissions_team_fkey" { columns = [column.team_id] ref_columns = [table.teams.column.id] on_update = NO_ACTION - on_delete = NO_ACTION + on_delete = CASCADE } index "permissions_config_id_idx" {