-
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
Add option to downgrade
DB as part of /admin/db
endpoint
#4893
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Passing run #7853 ↗︎
Details:
Review all test suite changes for PR #4893 ↗︎ |
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.
some notes on misc. cleanup changes i made along the way.
src/fides/api/alembic/migrations/versions/fc2b2c06e595_add_detection_discovery_tables.py
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4893 +/- ##
==========================================
- Coverage 86.78% 86.72% -0.06%
==========================================
Files 347 347
Lines 21102 21121 +19
Branches 2762 2765 +3
==========================================
+ Hits 18313 18317 +4
- Misses 2303 2315 +12
- Partials 486 489 +3 ☔ 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.
i really like exposing the current revision here.
Further comments: https://ethyca.atlassian.net/browse/PROD-2087?focusedCommentId=41060
Reviewing - |
* If there are any database migrations: | ||
* [ ] Ensure that your downrev is up to date with the latest revision on `main` | ||
* [ ] Ensure that your `downgrade()` migration is correct and works | ||
* [ ] If a downgrade migration is not possible for this change, please call this out in the PR description! |
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.
nice changelog additions 👍
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.
Looks good to me, I especially like the re-org.
There's an outstanding existing issue if we upgrade and it fails, the API returns that it succeeded, but the logs show the failure. I think we should reticket -
ah yes sorry i ignored that because it was already there and i was the slightest bit unsure about how to best handle/got a bit worried about breaking things. i'll create a follow up ticket - thanks for the speedy and helpful review on this! |
ticketed https://ethyca.atlassian.net/browse/PROD-2118 as a follow up for the upgrade issue you uncovered 👍 |
Closes PROD-2087
Description Of Changes
Adds a downgrade option to our
/admin/db
endpoint. Allows specifying a migration revision as arevision
query param.revision
query param can also be used for upgrade command now, if desired - though in practice, that probably won't be needed much.Also adds the current revision number/name as a field in the
/health/database
endpoint response, e.g.See issue description for more context.
Code Changes
downgrade
action to path param enum. executes an alembic downgrade against the dbrevision
optional query param to allow for migration revision name/number to be specified on the endpoint/health/database
endpoint.Steps to Confirm
nox -s dev
/api/v1/admin/db/downgrade
endpoint (e.g. thru swagger UI) and specify arevision
that's lower than thehead
on main, e.g.9e83545ed9b6
alembic_version.version_num
value is therevision
that was specified in the step abovePre-Merge Checklist
CHANGELOG.md