Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(policy): Cascade delete policy when scope is deleted #5014

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

louisruch
Copy link
Collaborator

No description provided.

This comment has been minimized.

Copy link

Database schema diff between main and louis-org-policy @ 7c483e3

To understand how these diffs are generated and some limitations see the
documentation of the script.

Functions

Unchanged

Tables

Unchanged

Views

Unchanged

Triggers

Unchanged

Indexes

Unchanged

Constraints

Unchanged

Foreign Key Constraints

diff --git a/.schema-diff/fk_constraints_903039e88567379513ba420bb44d6b90fc047f15/policy_scope_id_fkey.sql b/.schema-diff/fk_constraints_25176fe370e000d8bd38a8c860b13862c28d8851/policy_scope_id_fkey.sql
index f2629ab4c..551cdf964 100644
--- a/.schema-diff/fk_constraints_903039e88567379513ba420bb44d6b90fc047f15/policy_scope_id_fkey.sql
+++ b/.schema-diff/fk_constraints_25176fe370e000d8bd38a8c860b13862c28d8851/policy_scope_id_fkey.sql
@@ -1,6 +1,6 @@
 -- name: policy policy_scope_id_fkey; type: fk constraint; schema: public; owner: -
-    add constraint policy_scope_id_fkey foreign key (scope_id) references public.iam_scope(public_id) on update cascade on delete restrict;
+    add constraint policy_scope_id_fkey foreign key (scope_id) references public.iam_scope(public_id) on update cascade on delete cascade;
 -- name: policy_storage_policy policy_storage_policy_scope_id_fkey; type: fk constraint; schema: public; owner: -
-    add constraint policy_storage_policy_scope_id_fkey foreign key (scope_id) references public.iam_scope(public_id) on update cascade on delete restrict;
+    add constraint policy_storage_policy_scope_id_fkey foreign key (scope_id) references public.iam_scope(public_id) on update cascade on delete cascade;
 -- name: scope_policy_storage_policy scope_policy_storage_policy_scope_id_fkey; type: fk constraint; schema: public; owner: -
     add constraint scope_policy_storage_policy_scope_id_fkey foreign key (scope_id) references public.iam_scope(public_id) on update cascade on delete cascade;
diff --git a/.schema-diff/fk_constraints_903039e88567379513ba420bb44d6b90fc047f15/policy_storage_policy_scope_id_fkey.sql b/.schema-diff/fk_constraints_25176fe370e000d8bd38a8c860b13862c28d8851/policy_storage_policy_scope_id_fkey.sql
index 4e2a7cdf8..29b51cfb5 100644
--- a/.schema-diff/fk_constraints_903039e88567379513ba420bb44d6b90fc047f15/policy_storage_policy_scope_id_fkey.sql
+++ b/.schema-diff/fk_constraints_25176fe370e000d8bd38a8c860b13862c28d8851/policy_storage_policy_scope_id_fkey.sql
@@ -1,4 +1,4 @@
 -- name: policy_storage_policy policy_storage_policy_scope_id_fkey; type: fk constraint; schema: public; owner: -
-    add constraint policy_storage_policy_scope_id_fkey foreign key (scope_id) references public.iam_scope(public_id) on update cascade on delete restrict;
+    add constraint policy_storage_policy_scope_id_fkey foreign key (scope_id) references public.iam_scope(public_id) on update cascade on delete cascade;
 -- name: scope_policy_storage_policy scope_policy_storage_policy_scope_id_fkey; type: fk constraint; schema: public; owner: -
     add constraint scope_policy_storage_policy_scope_id_fkey foreign key (scope_id) references public.iam_scope(public_id) on update cascade on delete cascade;

@louisruch louisruch requested a review from hugoghx August 13, 2024 23:49
@louisruch
Copy link
Collaborator Author

@hugoghx PTAL, this came up as a potential bug since a user could not delete a org without first deleting all policies. Since we cannot delete the global scope this will only impact orgs and since the policy can only be used by the org and is not directly associated with any session recordings I believe this change is sound. Please let me know if you can think of any reason to restrict delete.

Copy link
Collaborator

@hugoghx hugoghx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I can't think of any issues with this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants