-
Notifications
You must be signed in to change notification settings - Fork 0
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
DDO-3242: Remove "v2_" from table names #335
Conversation
No API changes detected |
Codecov Report
@@ Coverage Diff @@
## main #335 +/- ##
=======================================
Coverage 63.23% 63.23%
=======================================
Files 147 147
Lines 8671 8671
=======================================
Hits 5483 5483
Misses 2813 2813
Partials 375 375
|
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 great! My one comment is that I don't think we should change metrics/metrics.go in this PR because that'll impact Prometheus, not the DB, and we'll want to roll that out differently than the database changes
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
When we migration from sherlock v1 to v2, we renamed many database tables, indexes, foreign keys, keys, and sequences to include "v2_" in the name. Now, we are migrating to sherlock v3 and these resources no longer accurately reflect the current environment. During the first migration to v2, we were creating new resources. In this migration to v3, we will still be using the same resources, and will continue to use these resources for the foreseeable future. We will not add "v3_" to the resource names, so that if we do further migrations in the future, these resources will continue to reflect the current state.
This change included two parts.
rename
command in both the up and down migrations. Unfortunately,rename
commands cannot be stacked, so each rename had to be written as it's own command. The migrations are organized by table and then split into keys, foreign keys, and indexes. All sequence commands are at the bottom.Testing
I tested this locally by
migrate -path sherlock/db/migrations -database 'postgres://sherlock:password@localhost:5432/sherlock?sslmode=disable' goto 59
and
migrate -path sherlock/db/migrations -database 'postgres://sherlock:password@localhost:5432/sherlock?sslmode=disable' goto 60
to test down and up, respectively.
Risk
This change will affect many resources in the database and will require downtime, but is easy to revert using ArgoCD. We will push to dev first and make sure it spins up.