diff --git a/nicohack202002/uncloud/opennebula/migrations/0003_auto_20200223_1058.py b/nicohack202002/uncloud/opennebula/migrations/0003_auto_20200223_1058.py new file mode 100644 index 0000000..d2173da --- /dev/null +++ b/nicohack202002/uncloud/opennebula/migrations/0003_auto_20200223_1058.py @@ -0,0 +1,19 @@ +# 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/nicohack202002/uncloud/opennebula/models.py b/nicohack202002/uncloud/opennebula/models.py index 0f93b78..ff0e49c 100644 --- a/nicohack202002/uncloud/opennebula/models.py +++ b/nicohack202002/uncloud/opennebula/models.py @@ -6,7 +6,7 @@ from django.contrib.postgres.fields import JSONField class VM(models.Model): vmid = models.IntegerField(primary_key=True) - uuid = models.UUIDField(default=uuid.uuid4, editable=False) + uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True) owner = models.ForeignKey(get_user_model(), on_delete=models.CASCADE) data = JSONField()