Total Complexity | 6 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from django.db import migrations |
||
2 | |||
3 | |||
4 | def forwards(apps, schema_editor): |
||
5 | BugSystem = apps.get_model('testcases', 'BugSystem') |
||
6 | |||
7 | for record in BugSystem.objects.all(): |
||
8 | if record.tracker_type: |
||
9 | record.tracker_type = "tcms.issuetracker.types.%s" % record.tracker_type |
||
10 | record.save() |
||
11 | |||
12 | |||
13 | def backwards(apps, schema_editor): |
||
14 | BugSystem = apps.get_model('testcases', 'BugSystem') |
||
15 | |||
16 | for record in BugSystem.objects.all(): |
||
17 | if record.tracker_type.startswith('tcms.issuetracker.types.'): |
||
18 | record.tracker_type = record.tracker_type.replace('tcms.issuetracker.types.', '') |
||
19 | record.save() |
||
20 | |||
21 | |||
22 | class Migration(migrations.Migration): |
||
23 | |||
24 | dependencies = [ |
||
25 | ('testcases', '0013_remove_autofield'), |
||
26 | ] |
||
27 | |||
28 | operations = [ |
||
29 | migrations.RunPython(forwards, backwards), |
||
30 | ] |
||
31 |