Skip to content

Commit 8d420d4

Browse files
committed
Added initial data to the versioninfo migration.
- Legacy-Id: 13638
1 parent c4b64e5 commit 8d420d4

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

ietf/utils/migrations/0003_versioninfo.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@
55
from django.db import migrations, models
66

77

8+
data = [
9+
{
10+
"command": "xym",
11+
"switch": "--version",
12+
"used": True,
13+
"version": "xym 0.3.2"
14+
},
15+
{
16+
"command": "pyang",
17+
"switch": "--version",
18+
"used": True,
19+
"version": "pyang 1.7.2"
20+
},
21+
{
22+
"command": "yanglint",
23+
"switch": "--version",
24+
"used": True,
25+
"version": "yanglint 0.12.183"
26+
}
27+
]
28+
29+
def forwards(apps, schema_editor):
30+
VersionInfo = apps.get_model('utils', 'VersionInfo')
31+
for item in data:
32+
VersionInfo.objects.create(**item)
33+
34+
def backwards(apps, schema_editor):
35+
pass
36+
837
class Migration(migrations.Migration):
938

1039
dependencies = [
@@ -26,4 +55,5 @@ class Migration(migrations.Migration):
2655
'verbose_name_plural': 'VersionInfo',
2756
},
2857
),
58+
migrations.RunPython(forwards, backwards),
2959
]

0 commit comments

Comments
 (0)