77class Migration (SchemaMigration ):
88
99 def forwards (self , orm ):
10-
11- # Renaming column for 'Revision.branch' to match new field type.
12- db .rename_column ('codespeed_revision' , 'branch' , 'branch_id' )
13- # Changing field 'Revision.branch'
14- db .alter_column ('codespeed_revision' , 'branch_id' , self .gf ('django.db.models.fields.related.ForeignKey' )(to = orm ['codespeed.Branch' ]))
10+
11+ # Adding field 'Revision.branch_id'
12+ db .add_column ('codespeed_revision' , 'branch' , self .gf ('django.db.models.fields.related.ForeignKey' )(null = True , to = orm ['codespeed.Branch' ]))
13+ # Removing unique constraint on 'Revision', fields ['commitid', 'project', branch']
14+ db .delete_unique ('codespeed_revision' , ['commitid' , 'project_id' , 'branch' ])
15+ # Delete field 'Revision.branch'
16+ db .delete_column ('codespeed_revision' , 'branch' )
17+ # Adding unique constraint on 'Revision', fields ['commitid', 'project_id', 'branch_id']
18+ db .create_unique ('codespeed_revision' , ['commitid' , 'project_id' , 'branch_id' ])
19+
1520
1621 # Adding index on 'Revision', fields ['branch']
1722 # NOTE: commented out because it can cause an
@@ -20,7 +25,7 @@ def forwards(self, orm):
2025
2126
2227 def backwards (self , orm ):
23-
28+
2429 # Removing index on 'Revision', fields ['branch']
2530 db .delete_index ('codespeed_revision' , ['branch_id' ])
2631
0 commit comments