aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/migrations/0012_manual_20200218_1536.py
blob: 55befbdb92fcf20875c79d4c96d255f950a1a088 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Generated by Django 2.2 on 2020-02-18 15:36

from django.db import migrations


def set_resource_id(apps, schema_editor):
    for cls in ["HostHardwareRelation", "HostNetworkRelation", "SnapshotConfig"]:
        model = apps.get_model('api', cls)
        for m in model.objects.all():
            m.resource_id = m.host.labid
            m.save()


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0011_auto_20200218_1536'),
    ]

    operations = [
        migrations.RunPython(set_resource_id),
    ]