Skip to content

Commit

Permalink
[db] Enforce order in which migrations are applied
Browse files Browse the repository at this point in the history
In 9e33378 we should have had a migration which does
AlterField on LinkReference.test_case_run to update the FK
constraint to the new `TestExecution` name!

Didn't catch this b/c Django was ordering migrations in such a
way that there wasn't a problem. Also the DB engines probably
automatically handled the model name change for all foreign key
fields.

However with the next commit the order in which migrations are
applied changes (b/c we add new model referencing TestExecution)
and we started seeing failures b/c linkreference.0001 started
being applied after testruns.0006 at which point there is no
`TestCaseRun` model to reference as the foreign key in the first
place.

FYI @asankov
  • Loading branch information
atodorov committed Sep 4, 2019
1 parent 0c01210 commit 309e982
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -24,6 +24,9 @@ class Migration(migrations.Migration):
('testcases', '0008_notifications_default_true'),
('management', '0005_order_by_name'),
('testruns', '0005_remove_unused_fields'),
# enforces migrations order b/c linkreference.0001
# refers to TestCaseRun which we rename here
('linkreference', '0001_squashed'),
]

operations = [
Expand Down

0 comments on commit 309e982

Please sign in to comment.