aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/migrations
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2020-02-18 13:17:10 -0500
committerParker Berberian <pberberian@iol.unh.edu>2020-02-20 11:40:30 -0500
commitd73588dfe1066f85bb83df0e3c0881ff42c25e04 (patch)
treed03a3f318d5711253f8359c5bcfd282c9a5f550c /src/api/migrations
parent8c012f8a9bc64add11920688abcd6981278cb0ea (diff)
Add Migration Files
Adds migration files with some custom logic to accompany the refactoring in resource_inventory. Change-Id: Id3b3e46913c1f9a102426a5c33d7a282f46e8b28 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/api/migrations')
-rw-r--r--src/api/migrations/0011_auto_20200218_1536.py54
-rw-r--r--src/api/migrations/0012_manual_20200220.py18
2 files changed, 72 insertions, 0 deletions
diff --git a/src/api/migrations/0011_auto_20200218_1536.py b/src/api/migrations/0011_auto_20200218_1536.py
new file mode 100644
index 0000000..a399495
--- /dev/null
+++ b/src/api/migrations/0011_auto_20200218_1536.py
@@ -0,0 +1,54 @@
+# Generated by Django 2.2 on 2020-02-18 15:36
+
+from django.db import migrations, models
+
+
+def set_resource_id(apps, schema_editor):
+ for cls in ["HardwareConfig", "NetworkConfig", "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', '0010_auto_20191219_2004'),
+ # ('resource_inventory', '0013_auto_20200218_1536')
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='hosthardwarerelation',
+ name='resource_id',
+ field=models.CharField(default='default_id', max_length=200),
+ ),
+ migrations.AddField(
+ model_name='hostnetworkrelation',
+ name='resource_id',
+ field=models.CharField(default='default_id', max_length=200),
+ ),
+ migrations.AddField(
+ model_name='snapshotconfig',
+ name='resource_id',
+ field=models.CharField(default='default_id', max_length=200),
+ ),
+ migrations.RunPython(set_resource_id),
+ migrations.RemoveField(
+ model_name='hosthardwarerelation',
+ name='host',
+ ),
+ migrations.RemoveField(
+ model_name='hostnetworkrelation',
+ name='host',
+ ),
+ migrations.RemoveField(
+ model_name='snapshotconfig',
+ name='host',
+ ),
+ migrations.RemoveField(
+ model_name='opnfvapiconfig',
+ name='roles',
+ ),
+ ]
diff --git a/src/api/migrations/0012_manual_20200220.py b/src/api/migrations/0012_manual_20200220.py
new file mode 100644
index 0000000..40f7e79
--- /dev/null
+++ b/src/api/migrations/0012_manual_20200220.py
@@ -0,0 +1,18 @@
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0011_auto_20200218_1536'),
+ ('resource_inventory', '0013_auto_20200218_1536')
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='opnfvapiconfig',
+ name='roles',
+ field=models.ManyToManyField(to='resource_inventory.ResourceOPNFVConfig'),
+ ),
+ ]