-
Notifications
You must be signed in to change notification settings - Fork 25
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
Added evolution file to apply foreign key constraints to database #3692
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jetpackjules these are small things to clean up, but I'll throw them to you now so that you can change them before I get a chance to fully review/test this!
- I don't see the comments as adding anything, really. It's basically as verbose as the SQL itself, and the SQL is pretty self explanatory, so I think that we can just remove these comments.
- Let's reduce the length of the file slightly by combining the last two lines of each:
ALTER TABLE audit_task ADD CONSTRAINT fk_audit_task_amt_assignment FOREIGN KEY (amt_assignment_id) REFERENCES amt_assignment(amt_assignment_id);
- And for the Down section, let's just make each of those one line!
- For the Downs section, technically they should be in reverse order compared to the Ups... If the Downs are "undoing" the Ups, then we go in reverse order! Doesn't have any practical implications for this file, but we should stick to it because it sometimes matters!
I changed the evolution number to fix the conflict and did the simple requested reformatting.
Thanks for the preliminary feedback, I've implemented the changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another couple things to change before I test!
Used default constraint names and fixed downs by specifying table
Resolves #3574
The issue was that missing foreign key constraints would allow for certain incorrect insertions or deletions (Like null), and "removing data wasn't cascading to all the tables you'd expect." I've added a DB conf evolution that should manually add all the proper foreign key constraints and fix the issue.
BEFORE:
AFTER:
Testing instructions
To check if the fix worked, check foreign key constraints in the relevant database with:
Run these lines in a separate WSL terminal in the root directory of the project:
(The above should output a table listing all foreign key constraints)
Things to check before submitting the PR