-
Notifications
You must be signed in to change notification settings - Fork 72
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
update appconfig migration to handle existing record #2780
update appconfig migration to handle existing record #2780
Conversation
Passing run #710 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #2780 +/- ##
=======================================
Coverage 86.55% 86.55%
=======================================
Files 291 291
Lines 16488 16488
Branches 2117 2117
=======================================
Hits 14272 14272
Misses 1817 1817
Partials 399 399 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
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.
this looks fine! I've provided some other optional paths, but this is good too.
src/fides/api/ctl/migrations/versions/c9ee230fa6da_add_config_set_column_to_application_.py
Outdated
Show resolved
Hide resolved
src/fides/api/ctl/migrations/versions/c9ee230fa6da_add_config_set_column_to_application_.py
Outdated
Show resolved
Hide resolved
src/fides/api/ctl/migrations/versions/c9ee230fa6da_add_config_set_column_to_application_.py
Outdated
Show resolved
Hide resolved
f0b4be1
to
aab7ea5
Compare
aab7ea5
to
4a8d593
Compare
Closes #2779
Code Changes
server_default
of encrypted{}
value when creating theconfig_set
column in migration, so as to handle cases where an existingappconfig
record exists while allow the new column to be nullable.Steps to Confirm
Pre-Merge Checklist
CHANGELOG.md
Description Of Changes
the proposed solution is not ideal - i'm not sure of a truly clean way to handle this. the column in question here is a new column in2.8.x
and it's an encrypted JSON column that ideally should be non-nullable. before this change, the problem with the migration was that it just added the non-nullable column to the table, but doesn't account for the fact that there may be an existing record in the db, even though that's quite a narrow edge case. but in that case, the new non-nullable column is added to the record, but the column is obviously null since it didn't exist, and that's the error we get.the "obvious" fix would be to give that column a
server_default
when creating it in the migration, so that it's not null.but i don't think we can do effectively that from the context of the migration, since it's encrypted JSON, and it's not like the migration has access to the app encryption key.UPDATE - i was totally wrong about this, thanks to @pattisdr for showing me that we do indeed have access to the app encryption key in the migration. so this is the path i've decided on now!it's worth noting that this is handling a pretty narrow edge case - but @RobertKeyser did run into it on a migration of an internally hosted app, so it's worth us fixing!