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: Track rule type instantiations in profiles #1113

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Oct 5, 2023

This starts tracking rule type instantions in profiles by introducing a table to track
these. This table is populated when creating a new profile and is checked
before deleting a rule type. We thus not allow folks to delete rule types
if there is a profile instantiating it.

Note that the rule type IDs and profile IDs are tracked in the entity_profile_rules
table using a the ON DELETE CASCADE feature. Thus, when a profile is deleted, the
instantiations get cleaned up as well.

Note that we currently don't support updated profiles (yet), so there was nowhere to
add this logic for such a case. This will need to be considered once that feature is
implemented.

Closes: #1112

This starts tracking rule type instantions in profiles by introducing a table to track
these. This table is populated when creating a new profile and is checked
before deleting a rule type. We thus not allow folks to delete rule types
if there is a profile instantiating it.

Note that the rule type IDs and profile IDs are tracked in the `entity_profile_rules`
table using a the `ON DELETE CASCADE` feature. Thus, when a profile is deleted, the
instantiations get cleaned up as well.

Note that we currently don't support updated profiles (yet), so there was nowhere to
add this logic for such a case. This will need to be considered once that feature is
implemented.

Closes: #1112
@JAORMX JAORMX requested a review from jhrozek October 5, 2023 11:52
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

I think this is fine and I can't figure out another way except another table either. I left one question inline.

database/query/profiles.sql Show resolved Hide resolved
@JAORMX JAORMX merged commit 36a8f1b into main Oct 5, 2023
12 checks passed
@JAORMX JAORMX deleted the track-rule-instantiations branch October 5, 2023 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule type deletions may cause data inconsistencies
2 participants