From 15b0fe3dc9b9cee90a3aac530cad281e9766c160 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 23 Feb 2020 18:11:14 +0100 Subject: [PATCH] fix migrations the ugly way Signed-off-by: Nico Schottelius --- uncloud/opennebula/migrations/0001_initial.py | 4 +- uncloud/opennebula/migrations/0002_vm_uuid.py | 19 -------- .../migrations/0003_auto_20200223_1058.py | 19 -------- .../migrations/0004_auto_20200222_0713.py | 23 ---------- .../uncloud_api/migrations/0001_initial.py | 4 +- .../migrations/0002_auto_20200222_0719.py | 46 ------------------- uncloud/uncloud_api/models.py | 7 ++- .../uncloud_auth/migrations/0001_initial.py | 2 +- uncloud/uncloud_vm/migrations/__init__.py | 0 9 files changed, 12 insertions(+), 112 deletions(-) delete mode 100644 uncloud/opennebula/migrations/0002_vm_uuid.py delete mode 100644 uncloud/opennebula/migrations/0003_auto_20200223_1058.py delete mode 100644 uncloud/opennebula/migrations/0004_auto_20200222_0713.py delete mode 100644 uncloud/uncloud_api/migrations/0002_auto_20200222_0719.py delete mode 100644 uncloud/uncloud_vm/migrations/__init__.py diff --git a/uncloud/opennebula/migrations/0001_initial.py b/uncloud/opennebula/migrations/0001_initial.py index f1d3d6b..7fa9154 100644 --- a/uncloud/opennebula/migrations/0001_initial.py +++ b/uncloud/opennebula/migrations/0001_initial.py @@ -1,9 +1,10 @@ -# Generated by Django 3.0.3 on 2020-02-23 10:02 +# Generated by Django 3.0.3 on 2020-02-23 17:08 from django.conf import settings import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion +import uuid class Migration(migrations.Migration): @@ -19,6 +20,7 @@ class Migration(migrations.Migration): name='VM', fields=[ ('vmid', models.IntegerField(primary_key=True, serialize=False)), + ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)), ('data', django.contrib.postgres.fields.jsonb.JSONField()), ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], diff --git a/uncloud/opennebula/migrations/0002_vm_uuid.py b/uncloud/opennebula/migrations/0002_vm_uuid.py deleted file mode 100644 index 595fd05..0000000 --- a/uncloud/opennebula/migrations/0002_vm_uuid.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-23 10:55 - -from django.db import migrations, models -import uuid - - -class Migration(migrations.Migration): - - dependencies = [ - ('opennebula', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='vm', - name='uuid', - field=models.UUIDField(default=uuid.uuid4, editable=False), - ), - ] diff --git a/uncloud/opennebula/migrations/0003_auto_20200223_1058.py b/uncloud/opennebula/migrations/0003_auto_20200223_1058.py deleted file mode 100644 index d2173da..0000000 --- a/uncloud/opennebula/migrations/0003_auto_20200223_1058.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-23 10:58 - -from django.db import migrations, models -import uuid - - -class Migration(migrations.Migration): - - dependencies = [ - ('opennebula', '0002_vm_uuid'), - ] - - operations = [ - migrations.AlterField( - model_name='vm', - name='uuid', - field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True), - ), - ] diff --git a/uncloud/opennebula/migrations/0004_auto_20200222_0713.py b/uncloud/opennebula/migrations/0004_auto_20200222_0713.py deleted file mode 100644 index a298c06..0000000 --- a/uncloud/opennebula/migrations/0004_auto_20200222_0713.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-22 07:13 - -from django.db import migrations, models -import uuid - - -class Migration(migrations.Migration): - - dependencies = [ - ('opennebula', '0003_auto_20200221_1113'), - ] - - operations = [ - migrations.RemoveField( - model_name='vm', - name='id', - ), - migrations.AddField( - model_name='vm', - name='uuid', - field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False), - ), - ] diff --git a/uncloud/uncloud_api/migrations/0001_initial.py b/uncloud/uncloud_api/migrations/0001_initial.py index d8d9630..cc3944c 100644 --- a/uncloud/uncloud_api/migrations/0001_initial.py +++ b/uncloud/uncloud_api/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.3 on 2020-02-23 10:16 +# Generated by Django 3.0.3 on 2020-02-23 17:09 from django.conf import settings from django.db import migrations, models @@ -19,7 +19,7 @@ class Migration(migrations.Migration): name='VMSnapshotProduct', fields=[ ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), - ('status', models.CharField(choices=[('pending', 'Pending'), ('being_created', 'Being created'), ('created_active', 'Created'), ('deleted', 'Deleted')], default='pending', max_length=256)), + ('status', models.CharField(choices=[('pending', 'Pending'), ('being_created', 'Being created'), ('active', 'Active'), ('deleted', 'Deleted')], default='pending', max_length=256)), ('gb_ssd', models.FloatField()), ('gb_hdd', models.FloatField()), ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), diff --git a/uncloud/uncloud_api/migrations/0002_auto_20200222_0719.py b/uncloud/uncloud_api/migrations/0002_auto_20200222_0719.py deleted file mode 100644 index a52eade..0000000 --- a/uncloud/uncloud_api/migrations/0002_auto_20200222_0719.py +++ /dev/null @@ -1,46 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-22 07:19 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('uncloud_api', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='VMSnapshotOrder', - fields=[ - ('order_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='uncloud_api.Order')), - ], - bases=('uncloud_api.order',), - ), - migrations.CreateModel( - name='VMSnapshotProduct', - fields=[ - ('product_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='uncloud_api.Product')), - ('gb_ssd', models.FloatField()), - ('gb_hdd', models.FloatField()), - ], - bases=('uncloud_api.product',), - ), - migrations.DeleteModel( - name='OrderReference', - ), - migrations.RemoveField( - model_name='product', - name='name', - ), - migrations.RemoveField( - model_name='product', - name='recurring_period', - ), - migrations.AddField( - model_name='product', - name='status', - field=models.CharField(choices=[('pending', 'Pending'), ('being_created', 'Being created'), ('created_active', 'Created'), ('deleted', 'Deleted')], default='pending', max_length=256), - ), - ] diff --git a/uncloud/uncloud_api/models.py b/uncloud/uncloud_api/models.py index 11a7560..1540e69 100644 --- a/uncloud/uncloud_api/models.py +++ b/uncloud/uncloud_api/models.py @@ -45,12 +45,17 @@ class Product(models.Model): choices = ( ('pending', 'Pending'), ('being_created', 'Being created'), - ('created_active', 'Created'), + ('active', 'Active'), ('deleted', 'Deleted') ), default='pending' ) + recurring_price = models.FloatField() + one_time_price = models.FloatField() + + + class Meta: abstract = True diff --git a/uncloud/uncloud_auth/migrations/0001_initial.py b/uncloud/uncloud_auth/migrations/0001_initial.py index a3ade55..73072a5 100644 --- a/uncloud/uncloud_auth/migrations/0001_initial.py +++ b/uncloud/uncloud_auth/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.3 on 2020-02-23 10:02 +# Generated by Django 3.0.3 on 2020-02-23 17:08 import django.contrib.auth.models import django.contrib.auth.validators diff --git a/uncloud/uncloud_vm/migrations/__init__.py b/uncloud/uncloud_vm/migrations/__init__.py deleted file mode 100644 index e69de29..0000000