-
Notifications
You must be signed in to change notification settings - Fork 38
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/url history defaults #1800
Fix/url history defaults #1800
Conversation
Verified the following info about the gosg-staging has '' as default Did a bit of reading up as to how this happened, I suspect it's due to the differences between the migration file and the sequelize model definition. Given that the edit: managed to find the offending PR which holds a bit of context as to how this happened, for enrichment purposes 😂 |
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.
Both the code and strategy looks good to me! i'd just like to propose one more addition to this PR which would be to explicitly commit a migration sql file into the codebase, similar to what has been done in this directory.
Even though the migration script is probably gonna just be a one-liner wrapped in a transaction, there's value in tracking the list of migrations we've done in production, and reduce the risk of executing incorrect commands on the database
Fixed in 20f898d |
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.
lgtm!
Problem
What problem are you trying to solve? What issue does this close?
Lambda functions for migrating links were not running successfully on
health-staging-db
as thedescription
column inurl_histories
tables had a constraint that enforced non-null values but did not set a default value.Related to this, the two SQL migration functions did not include
description
as an indexed column fromurl
table when inserting the link into theurl_histories
table. Hence, when a new migration attempted to occur, thedescription
in theurl
table was not being copied into the new row inurl_histories
table, so the column defaulted tonull
, violating the non-null constraint.Solution
How did you solve the problem?
description
as an indexed column onurl
table when inserting the link into theurl_histories
tabledescription
column inurl_histories
table in database modelsFeatures:
Improvements:
Bug Fixes:
Before & After Screenshots
BEFORE:
[insert screenshot here]
AFTER:
[insert screenshot here]
Tests
What tests should be run to confirm functionality?
migrate-short-link
onhealth-staging
migrate-user-links
onhealth-staging
Deploy Notes
Notes regarding deployment of the contained body of work. These should note any
new dependencies, new scripts, etc.
Related fixes
Code changes
description
when migrating urldescription
column inurl_histories
tableUpdate current databases
Health
health-staging
ALTER TABLE url_histories ADD "description" text NOT NULL DEFAULT '';
migrate-user-links
migrate-shortUrl-to-user
health-prod
since the model should be fixedEdu
edu-staging
ALTER TABLE url_histories ADD "description" text NOT NULL DEFAULT '';
migrate-user-links
migrate-shortUrl-to-user
edu-prod
ALTER TABLE url_histories ADD "description" text NOT NULL DEFAULT '';
migrate-user-links
migrate-shortUrl-to-user
GoGov
gogov-staging
(Not necessary inALTER TABLE url_histories ADD "description" text NOT NULL DEFAULT '';
gogov-staging
andgogov-prod
as previous migrations have added a default)migrate-user-links
migrate-shortUrl-to-user
gogov-prod
(Not necessary inALTER TABLE url_histories ADD "description" text NOT NULL DEFAULT '';
gogov-staging
andgogov-prod
as previous migrations have added a default)migrate-user-links
migrate-shortUrl-to-user