Oneoff migration pegasus.storage_apps => dashboard.projects - #45476
Conversation
85a1750 to
b036b43
Compare
| def fetch_featured_projects_by_type(project_type) | ||
| storage_apps = "#{CDO.pegasus_db_name}__storage_apps".to_sym | ||
|
|
||
| storage_apps_table = DCDO.get('storage_apps_in_dashboard', false) ? "#{CDO.dashboard_db_name}__projects".to_sym : "#{CDO.pegasus_db_name}__#{table_name}".to_sym |
There was a problem hiding this comment.
Do we need to qualify table_name with StorageApps here? Or maybe just hardcode it in?
There was a problem hiding this comment.
Whoops! This was an artifact of not being able to decide what to do. I'll hard-code it
There was a problem hiding this comment.
As a side-note, this shows that we do not have very good test coverage around this, since no tests failed 😬
| @@ -0,0 +1,69 @@ | |||
| require File.expand_path('../../../pegasus/src/env', __FILE__) | |||
There was a problem hiding this comment.
Not critical, but we have a convention to make our one-off scripts shell scripts by setting the first line to:
#!/usr/bin/env ruby
And making the file executable (an attribute that can be committed in git):
chmod +x bin/oneoff/move_storage_apps_to_dashboard.rb
And typically renaming to drop the .rb extension.
There was a problem hiding this comment.
@sureshc when I run chmod +x bin/oneoff/move_storage_apps_to_dashboard.rb I don't see any changes to commit, should I?
There was a problem hiding this comment.
Try setting filemode = true in [repository]/.git/config?
There was a problem hiding this comment.
Look like this command would accomplish the same:
git config core.filemode true
sureshc
left a comment
There was a problem hiding this comment.
I’m so excited about this! 😀
This is the one-off migration to be run on production to move the pegasus storage_apps table to dashboard with the name projects. A view with the old name is created for the time between when the migration is run in production and when we flip the DCDO flag to point the code at the new table name.
To roll out this change:
ruby bin/oneoff/move_storage_apps_to_dashboardDCDO.set('storage_apps_in_dashboard', true)To roll back the change:
DCDO.set('storage_apps_in_dashboard', false)ruby bin/oneoff/move_storage_apps_to_dashboard --revertLinks
Testing story
I've tested the steps to roll out and roll back the migration locally, verifying that projects load as expected at every step.
To Do:
Deployment strategy
These code changes will be deployed and when we're ready we'll work with Infra to find a time to run the migration.
Follow-up work
Once the migration has been run in production, we'll want to merge #45480 so that every environment will match production.
PR Checklist: