-
Notifications
You must be signed in to change notification settings - Fork 3
chore(shared): Generate missing migrations #277
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #277 +/- ##
=======================================
Coverage 94.33% 94.34%
=======================================
Files 1222 1226 +4
Lines 45309 45325 +16
Branches 1441 1441
=======================================
+ Hits 42744 42760 +16
Misses 2264 2264
Partials 301 301
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
CodSpeed Performance ReportMerging #277 will not alter performanceComparing Summary
|
Can you run a |
libs/shared/shared/django_apps/compare/migrations/0007_alter_commitcomparison_table_and_more.py
Show resolved
Hide resolved
...ango_apps/labelanalysis/migrations/0004_alter_labelanalysisprocessingerror_table_and_more.py
Show resolved
Hide resolved
...s/staticanalysis/migrations/0002_alter_staticanalysissinglefilesnapshot_state_id_and_more.py
Show resolved
Hide resolved
.../shared/django_apps/ta_timeseries/migrations/0016_remove_testrun_ta_ts__branch_i_and_more.py
Outdated
Show resolved
Hide resolved
...s/timeseries/migrations/0020_rename_ts__repo_test_time_i_ts__repo_test_id_time_i_and_more.py
Outdated
Show resolved
Hide resolved
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've verified that the Postgres alter tables will be a no-op in production. I would also want to get a review from @joseph-sentry to ensure that the TA migration on Timescale will be no-op in production (I don't have prod access to the timescale DBs to verify).
hmmm I messed this up when i created migrations that ran index migrations using SQL, I don't think there's any way to make Django aware of those index operations. I think the way to fix this is to: using only Risky migration statements, undo my index creation and deletion changes for the TA timeseries table, then add the indexes using django so it's aware |
0ae0c91
to
42da75d
Compare
operations = [ | ||
# Bringing the state in sync with the changes made manually with migration 0011 | ||
migrations.SeparateDatabaseAndState( | ||
database_operations=[ | ||
migrations.RunSQL( | ||
""" | ||
ALTER INDEX IF EXISTS ta_ts_upload_id_outcome_test_id_idx RENAME TO ta_ts_upload_outcome_test_idx; | ||
""" | ||
), | ||
], | ||
state_operations=[ | ||
migrations.RemoveIndex( | ||
model_name="testrun", | ||
name="ta_ts__branch_i", | ||
), | ||
migrations.RemoveIndex( | ||
model_name="testrun", | ||
name="ta_ts__test_i", | ||
), | ||
migrations.AddIndex( | ||
model_name="testrun", | ||
index=models.Index( | ||
fields=["upload_id", "outcome", "test_id"], | ||
name="ta_ts_upload_outcome_test_idx", | ||
), | ||
), | ||
], | ||
), | ||
] |
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.
python manage.py sqlmigrate ta_timeseries 0016 --database ta_timeseries
BEGIN;
--
-- Custom state/database change combination
--
ALTER INDEX IF EXISTS ta_ts_upload_id_outcome_test_id_idx RENAME TO ta_ts_upload_outcome_test_idx;
COMMIT;
42da75d
to
69c8a01
Compare
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. Just make sure you test this in staging as well. 👍
Old TA timeseries models that are not in use. Builds on #277
Old TA timeseries models that are not in use. Builds on #277
Old TA timeseries models that are not in use. Builds on #277
Resolves the
'model_name' have changes that are not yet reflected in a migration, and so won't be applied.
warning that we currently see for shared models. This has been tested in staging and had no issues.Note: There is one remaining migration that is more complicated for thePer #278, the model will be removed instead (#281)legacy_migrations
model that will be a separate PR.