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

Cascading deletion in DB #99479

Open
1 task
nihil2501 opened this issue Dec 18, 2024 · 0 comments
Open
1 task

Cascading deletion in DB #99479

nihil2501 opened this issue Dec 18, 2024 · 0 comments
Labels
accredited-rep-facing Accredited Representative Facing Team arf-icebox backend engineering Engineering topics

Comments

@nihil2501
Copy link
Contributor

nihil2501 commented Dec 18, 2024

Description

Even though I don't think most of the parent records described below should be getting deleted, if any did, there are child records that are nonsensical in the absence of their parent. We can add foreign key cascade delete for that and also a trigger in the polymorphic case. This is instead of using the :dependent option on ActiveRecord model associations or anything like that (can read about this in the Deleting from associations section of Rails API docs). Again, we're not going to delete the records and also buying into Rails's model-centrism for business logic and such needs a lot of motivation to actually opt in to in my opinion.

This deletion cascade should be defined in the DB:

  • power_of_attorney_requests -> power_of_attorney_forms
  • power_of_attorney_requests -> power_of_attorney_request_resolutions
  • power_of_attorney_request_resolutions -> power_of_attorney_request_decisions
  • power_of_attorney_request_resolutions -> power_of_attorney_request_expirations

Acceptance Criteria

  • Model spec mostly for the dev to prove to themselves that their DB schema migration enacts this behavior correctly, but the spec will need to be in a follow up PR because of code checks that require migration PRs to contain no other kinds of changes
@nihil2501 nihil2501 added backend engineering Engineering topics accredited-rep-facing Accredited Representative Facing Team labels Dec 18, 2024
@nihil2501 nihil2501 changed the title Add Cascade Deletion Migration Infrastructure - Backend core data integrity improvements - Cascading deletion in DB Jan 7, 2025
@nihil2501 nihil2501 changed the title Infrastructure - Backend core data integrity improvements - Cascading deletion in DB Cascading deletion in DB Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accredited-rep-facing Accredited Representative Facing Team arf-icebox backend engineering Engineering topics
Projects
None yet
Development

No branches or pull requests

2 participants