remove uuid primary key

Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
Nico Schottelius 2020-06-21 14:35:12 +02:00
parent 3ef19610f3
commit 1e68539ed8
53 changed files with 186 additions and 1249 deletions

View File

@ -1,10 +1,9 @@
# Generated by Django 3.0.3 on 2020-02-23 17:12
# Generated by Django 3.0.6 on 2020-06-21 12:34
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):
@ -20,7 +19,6 @@ 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)),
],

View File

@ -1,27 +0,0 @@
# Generated by Django 3.0.3 on 2020-02-25 13:35
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('opennebula', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='vm',
name='uuid',
),
migrations.RemoveField(
model_name='vm',
name='vmid',
),
migrations.AddField(
model_name='vm',
name='id',
field=models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False, unique=True),
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 3.0.3 on 2020-02-25 14:28
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('opennebula', '0002_auto_20200225_1335'),
]
operations = [
migrations.AlterField(
model_name='vm',
name='id',
field=models.CharField(default=uuid.uuid4, max_length=64, primary_key=True, serialize=False, unique=True),
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 3.0.3 on 2020-02-25 18:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opennebula', '0003_auto_20200225_1428'),
]
operations = [
migrations.RemoveField(
model_name='vm',
name='id',
),
migrations.AddField(
model_name='vm',
name='vmid',
field=models.IntegerField(default=42, primary_key=True, serialize=False),
preserve_default=False,
),
]

View File

@ -1,7 +1,8 @@
# Generated by Django 3.0.3 on 2020-03-03 16:49
# Generated by Django 3.0.6 on 2020-06-21 12:34
import django.contrib.auth.models
import django.contrib.auth.validators
import django.core.validators
from django.db import migrations, models
import django.utils.timezone
@ -29,6 +30,7 @@ class Migration(migrations.Migration):
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('maximum_credit', models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],

View File

@ -1,25 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-18 13:43
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_auth', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='amount',
field=models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AddField(
model_name='user',
name='maximum_credit',
field=models.FloatField(default=0),
preserve_default=False,
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-18 13:45
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_auth', '0002_auto_20200318_1343'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='amount',
),
migrations.AlterField(
model_name='user',
name='maximum_credit',
field=models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)]),
),
]

View File

@ -1,20 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-10 17:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0014_paymentsettings'),
('uncloud_auth', '0003_auto_20200318_1345'),
]
operations = [
migrations.AddField(
model_name='user',
name='primary_billing_address',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='uncloud_pay.BillingAddress'),
),
]

View File

@ -1,20 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-10 17:36
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0014_paymentsettings'),
('uncloud_auth', '0004_user_primary_billing_address'),
]
operations = [
migrations.AlterField(
model_name='user',
name='primary_billing_address',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='uncloud_pay.BillingAddress'),
),
]

View File

@ -17,11 +17,8 @@ class User(AbstractUser):
decimal_places=AMOUNT_DECIMALS,
validators=[MinValueValidator(0)])
# Need to use the string here to prevent a circular import
primary_billing_address = models.ForeignKey('uncloud_pay.BillingAddress',
on_delete=models.PROTECT,
blank=True,
null=True)
# @property
# def primary_billing_address(self):
@property
def balance(self):

View File

@ -1,4 +1,4 @@
# Generated by Django 3.0.5 on 2020-04-06 21:38
# Generated by Django 3.0.6 on 2020-06-21 12:34
from django.conf import settings
import django.contrib.postgres.fields.jsonb
@ -14,7 +14,7 @@ class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud_pay', '0001_initial'),
('uncloud_pay', '__first__'),
]
operations = [
@ -44,6 +44,7 @@ class Migration(migrations.Migration):
fields=[
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('address', models.GenericIPAddressField(primary_key=True, serialize=False)),
('status', models.CharField(choices=[('used', 'used'), ('free', 'free')], default='used', max_length=256)),
('vpnpool', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_net.VPNPool')),
],
options={
@ -53,11 +54,11 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='VPNNetwork',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32)),
('wireguard_public_key', models.CharField(max_length=48)),
('network', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_net.VPNNetworkReservation')),
('network', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='uncloud_net.VPNNetworkReservation')),
('order', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],

View File

@ -1,24 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-09 12:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='vpnnetworkreservation',
name='status',
field=models.CharField(choices=[('used', 'used'), ('free', 'free')], default='used', max_length=256),
),
migrations.AlterField(
model_name='vpnnetwork',
name='network',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='uncloud_net.VPNNetworkReservation'),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-17 05:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0002_auto_20200409_1225'),
]
operations = [
migrations.AlterField(
model_name='vpnnetwork',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32),
),
]

File diff suppressed because one or more lines are too long

View File

@ -1,27 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-05 15:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='paymentmethod',
old_name='stripe_card_id',
new_name='stripe_payment_method_id',
),
migrations.AddField(
model_name='paymentmethod',
name='stripe_setup_intent_id',
field=models.CharField(blank=True, max_length=32, null=True),
),
migrations.AlterUniqueTogether(
name='paymentmethod',
unique_together=set(),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-05 13:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0002_auto_20200305_1524'),
]
operations = [
migrations.AlterField(
model_name='paymentmethod',
name='primary',
field=models.BooleanField(default=False, editable=False),
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-09 12:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0003_auto_20200305_1354'),
]
operations = [
migrations.AlterField(
model_name='order',
name='recurring_period',
field=models.CharField(choices=[('ONCE', 'Onetime'), ('YEAR', 'Per Year'), ('MONTH', 'Per Month'), ('MINUTE', 'Per Minute'), ('WEEK', 'Per Week'), ('DAY', 'Per Day'), ('HOUR', 'Per Hour'), ('SECOND', 'Per Second')], default='MONTH', max_length=32),
),
migrations.AlterField(
model_name='order',
name='starting_date',
field=models.DateTimeField(),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-13 09:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0004_auto_20200409_1225'),
]
operations = [
migrations.AlterField(
model_name='order',
name='recurring_period',
field=models.CharField(choices=[('ONCE', 'Onetime'), ('YEAR', 'Per Year'), ('MONTH', 'Per Month'), ('WEEK', 'Per Week'), ('DAY', 'Per Day'), ('HOUR', 'Per Hour'), ('MINUTE', 'Per Minute'), ('SECOND', 'Per Second')], default='MONTH', max_length=32),
),
]

View File

@ -1,31 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-15 10:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0005_auto_20200413_0924'),
]
operations = [
migrations.CreateModel(
name='VATRate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('start_date', models.DateField(blank=True, null=True)),
('stop_date', models.DateField(blank=True, null=True)),
('territory_codes', models.TextField(blank=True, default='')),
('currency_code', models.CharField(max_length=10)),
('rate', models.FloatField()),
('rate_type', models.TextField(blank=True, default='')),
('description', models.TextField(blank=True, default='')),
],
),
migrations.AlterField(
model_name='order',
name='recurring_period',
field=models.CharField(choices=[('ONCE', 'Onetime'), ('YEAR', 'Per Year'), ('MONTH', 'Per Month'), ('WEEK', 'Per Week'), ('DAY', 'Per Day'), ('HOUR', 'Per Hour'), ('MINUTE', 'Per Minute'), ('SECOND', 'Per Second')], default='MONTH', max_length=32),
),
]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,19 +0,0 @@
# Generated by Django 3.0.5 on 2020-05-02 19:21
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0007_auto_20200418_0737'),
]
operations = [
migrations.AlterField(
model_name='order',
name='starting_date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]

View File

@ -1,47 +0,0 @@
# Generated by Django 3.0.5 on 2020-05-02 20:47
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud_pay', '0008_auto_20200502_1921'),
]
operations = [
migrations.AddField(
model_name='order',
name='one_time_price',
field=models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AddField(
model_name='order',
name='recurring_price',
field=models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AddField(
model_name='order',
name='replaced_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='uncloud_pay.Order'),
),
migrations.CreateModel(
name='OrderTimothee',
fields=[
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('creation_date', models.DateTimeField(auto_now_add=True)),
('starting_date', models.DateTimeField(default=django.utils.timezone.now)),
('ending_date', models.DateTimeField(blank=True, null=True)),
('recurring_period', models.CharField(choices=[('ONCE', 'Onetime'), ('YEAR', 'Per Year'), ('MONTH', 'Per Month'), ('WEEK', 'Per Week'), ('DAY', 'Per Day'), ('HOUR', 'Per Hour'), ('MINUTE', 'Per Minute'), ('SECOND', 'Per Second')], default='MONTH', max_length=32)),
('bill', models.ManyToManyField(blank=True, editable=False, to='uncloud_pay.Bill')),
('billing_address', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.BillingAddress')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-07 10:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0009_auto_20200502_2047'),
]
operations = [
migrations.AddField(
model_name='order',
name='description',
field=models.TextField(default=''),
preserve_default=False,
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-07 13:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0010_order_description'),
]
operations = [
migrations.AddField(
model_name='billingaddress',
name='organization',
field=models.CharField(default='', max_length=100),
preserve_default=False,
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-08 07:06
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud_pay', '0011_billingaddress_organization'),
]
operations = [
migrations.CreateModel(
name='BillNico',
fields=[
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('creation_date', models.DateTimeField(auto_now_add=True)),
('starting_date', models.DateTimeField()),
('ending_date', models.DateTimeField()),
('due_date', models.DateField()),
('valid', models.BooleanField(default=True)),
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -1,24 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-08 14:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0012_billnico'),
]
operations = [
migrations.AddField(
model_name='order',
name='depends_on',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='parent_of', to='uncloud_pay.Order'),
),
migrations.AlterField(
model_name='order',
name='replaced_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='supersede', to='uncloud_pay.Order'),
),
]

View File

@ -1,25 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-10 13:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud_pay', '0013_auto_20200508_1446'),
]
operations = [
migrations.CreateModel(
name='PaymentSettings',
fields=[
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('owner', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('primary_billing_address', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.BillingAddress')),
],
),
]

View File

@ -1,26 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-23 21:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0014_paymentsettings'),
]
operations = [
migrations.AlterField(
model_name='order',
name='recurring_period',
field=models.CharField(choices=[(31536000, 'Per 365 days'), (2592000, 'Per 30 days'), (604800, 'Per Week'), (86400, 'Per Day'), (3600, 'Per Hour'), (60, 'Per Minute'), (1, 'Per Second'), (0, 'Onetime')], default=2592000, max_length=32),
),
migrations.AlterField(
model_name='ordertimothee',
name='recurring_period',
field=models.CharField(choices=[(31536000, 'Per 365 days'), (2592000, 'Per 30 days'), (604800, 'Per Week'), (86400, 'Per Day'), (3600, 'Per Hour'), (60, 'Per Minute'), (1, 'Per Second'), (0, 'Onetime')], default=2592000, max_length=32),
),
migrations.DeleteModel(
name='PaymentSettings',
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-23 21:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0015_auto_20200523_2132'),
]
operations = [
migrations.AlterField(
model_name='order',
name='recurring_period',
field=models.IntegerField(choices=[(31536000, 'Per 365 days'), (2592000, 'Per 30 days'), (604800, 'Per Week'), (86400, 'Per Day'), (3600, 'Per Hour'), (60, 'Per Minute'), (1, 'Per Second'), (0, 'Onetime')], default=2592000),
),
migrations.AlterField(
model_name='ordertimothee',
name='recurring_period',
field=models.IntegerField(choices=[(31536000, 'Per 365 days'), (2592000, 'Per 30 days'), (604800, 'Per Week'), (86400, 'Per Day'), (3600, 'Per Hour'), (60, 'Per Minute'), (1, 'Per Second'), (0, 'Onetime')], default=2592000),
),
]

View File

@ -1,55 +0,0 @@
# Generated by Django 3.0.6 on 2020-06-21 11:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0016_auto_20200523_2138'),
]
operations = [
migrations.CreateModel(
name='BillRecord',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('usage_count', models.IntegerField(default=1)),
('creation_date', models.DateTimeField(auto_now_add=True)),
('starting_date', models.DateTimeField()),
('ending_date', models.DateTimeField()),
('bill', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Bill')),
],
),
migrations.RemoveField(
model_name='ordertimothee',
name='bill',
),
migrations.RemoveField(
model_name='ordertimothee',
name='billing_address',
),
migrations.RemoveField(
model_name='ordertimothee',
name='owner',
),
migrations.RemoveField(
model_name='order',
name='bill',
),
migrations.RemoveField(
model_name='order',
name='one_time_price',
),
migrations.RemoveField(
model_name='order',
name='recurring_price',
),
migrations.DeleteModel(
name='BillNico',
),
migrations.DeleteModel(
name='OrderTimothee',
),
]

View File

@ -1,25 +0,0 @@
# Generated by Django 3.0.6 on 2020-06-21 11:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0017_auto_20200621_1110'),
]
operations = [
migrations.AddField(
model_name='bill',
name='bill_records',
field=models.ManyToManyField(through='uncloud_pay.BillRecord', to='uncloud_pay.Order'),
),
migrations.AddField(
model_name='billrecord',
name='order',
field=models.ForeignKey(default=0, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order'),
preserve_default=False,
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 3.0.6 on 2020-06-21 11:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0018_auto_20200621_1140'),
]
operations = [
migrations.RemoveField(
model_name='bill',
name='uuid',
),
migrations.AddField(
model_name='bill',
name='id',
field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
preserve_default=False,
),
]

View File

@ -6,7 +6,6 @@ from django.core.validators import MinValueValidator
from django.utils import timezone
from django.core.exceptions import ObjectDoesNotExist, ValidationError
import uuid
import logging
from functools import reduce
import itertools
@ -77,8 +76,6 @@ class StripeCustomer(models.Model):
# Payments and Payment Methods.
class Payment(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.ForeignKey(get_user_model(),
on_delete=models.CASCADE)
@ -115,7 +112,6 @@ class Payment(models.Model):
class PaymentMethod(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.ForeignKey(get_user_model(),
on_delete=models.CASCADE,
editable=False)
@ -198,7 +194,6 @@ class PaymentMethod(models.Model):
# Bills.
class BillingAddress(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
organization = models.CharField(max_length=100)
@ -208,6 +203,14 @@ class BillingAddress(models.Model):
postal_code = models.CharField(max_length=50)
country = CountryField(blank=True)
vat_number = models.CharField(max_length=100, default="", blank=True)
active = models.BooleanField(default=False)
class Meta:
constraints = [
models.UniqueConstraint(fields=['owner'],
condition=Q(primary=True),
name='one_active_billing_address_per_user')
]
@staticmethod
def get_addresses_for(user):
@ -262,13 +265,13 @@ class Order(models.Model):
bills. Do **NOT** mutate then!
"""
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.ForeignKey(get_user_model(),
on_delete=models.CASCADE,
editable=False)
billing_address = models.ForeignKey(BillingAddress, on_delete=models.CASCADE)
editable=True)
billing_address = models.ForeignKey(BillingAddress,
on_delete=models.CASCADE)
description = models.TextField()
replaced_by = models.ForeignKey('self', on_delete=models.CASCADE, blank=True, null=True)
# TODO: enforce ending_date - starting_date to be larger than recurring_period.
creation_date = models.DateTimeField(auto_now_add=True)
@ -276,20 +279,6 @@ class Order(models.Model):
ending_date = models.DateTimeField(blank=True,
null=True)
# bill_records = models.ManyToManyField(BillRecord,
# editable=False,
# blank=True)
@property
def count_billed(self):
"""
How many times this order was billed so far.
This logic is mainly thought to be for recurring bills, but also works for one time bills
"""
return sum([ br.usage_count for br in self.bill_records.all() ])
recurring_period = models.IntegerField(choices = RecurringPeriod.choices,
default = RecurringPeriod.PER_30D)
@ -315,6 +304,16 @@ class Order(models.Model):
blank=True,
null=True)
@property
def count_billed(self):
"""
How many times this order was billed so far.
This logic is mainly thought to be for recurring bills, but also works for one time bills
"""
return sum([ br.usage_count for br in self.bill_records.all() ])
def active_before(self, ending_date):
# Was this order started before the specified ending date?
if self.starting_date <= ending_date:
@ -366,13 +365,6 @@ class Order(models.Model):
owner=product.owner,
**kwargs)
def __str__(self):
return "Order {} created at {}, {}->{}, recurring period {}. One time price {}, recurring price {}".format(
self.uuid, self.creation_date,
self.starting_date, self.ending_date,
self.recurring_period,
self.one_time_price,
self.recurring_price)
@property
def records(self):
@ -398,8 +390,8 @@ class Order(models.Model):
description=description)
def __str__(self):
return "Order {} created at {}, {}->{}, recurring period {}. Price one time {}, recurring {}".format(
self.uuid, self.creation_date,
return "{} created at {}, {}->{}, recurring period {}. One time price {}, recurring price {}".format(
self.id, self.creation_date,
self.starting_date, self.ending_date,
self.recurring_period,
self.one_time_price,
@ -411,7 +403,6 @@ class Bill(models.Model):
Bill needs to be unique in the triple (owner, year, month)
"""
# uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.ForeignKey(get_user_model(),
on_delete=models.CASCADE)
@ -570,7 +561,6 @@ class OrderRecord(models.Model):
# Abstract (= no database representation) class used as parent for products
# (e.g. uncloud_vm.models.VMProduct).
class Product(UncloudModel):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.ForeignKey(get_user_model(),
on_delete=models.CASCADE,
editable=False)

View File

@ -1,10 +1,10 @@
# Generated by Django 3.0.5 on 2020-04-13 09:38
# Generated by Django 3.0.6 on 2020-06-21 12:34
from django.conf import settings
import django.contrib.postgres.fields.jsonb
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
@ -12,8 +12,8 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('uncloud_pay', '0005_auto_20200413_0924'),
('uncloud_vm', '0010_auto_20200413_0924'),
('uncloud_pay', '0001_initial'),
('uncloud_vm', '__first__'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
@ -21,9 +21,9 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='MatrixServiceProduct',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32)),
('domain', models.CharField(default='domain.tld', max_length=255)),
('order', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
@ -33,4 +33,20 @@ class Migration(migrations.Migration):
'abstract': False,
},
),
migrations.CreateModel(
name='GenericServiceProduct',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32)),
('custom_description', models.TextField()),
('custom_recurring_price', models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
('custom_one_time_price', models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
('order', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
]

View File

@ -1,41 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-18 06:41
from django.conf import settings
import django.contrib.postgres.fields.jsonb
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud_pay', '0005_auto_20200413_0924'),
('uncloud_service', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='matrixserviceproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32),
),
migrations.CreateModel(
name='GenericServiceProduct',
fields=[
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32)),
('custom_description', models.TextField()),
('custom_recurring_price', models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
('custom_one_time_price', models.DecimalField(decimal_places=2, default=0.0, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
('order', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
]

View File

@ -1,6 +1,7 @@
# Generated by Django 3.0.3 on 2020-03-05 10:34
# Generated by Django 3.0.6 on 2020-06-21 12:34
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import uuid
@ -16,71 +17,82 @@ class Migration(migrations.Migration):
]
operations = [
migrations.CreateModel(
name='VMCluster',
fields=[
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=128, unique=True)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='VMDiskImageProduct',
fields=[
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=256)),
('is_os_image', models.BooleanField(default=False)),
('is_public', models.BooleanField(default=False)),
('is_public', models.BooleanField(default=False, editable=False)),
('size_in_gb', models.FloatField(blank=True, null=True)),
('import_url', models.URLField(blank=True, null=True)),
('image_source', models.CharField(max_length=128, null=True)),
('image_source_type', models.CharField(max_length=128, null=True)),
('storage_class', models.CharField(choices=[('hdd', 'HDD'), ('ssd', 'SSD')], default='ssd', max_length=32)),
('status', models.CharField(choices=[('pending', 'Pending'), ('creating', 'Creating'), ('active', 'Active'), ('disabled', 'Disabled'), ('unusable', 'Unusable'), ('deleted', 'Deleted')], default='pending', max_length=32)),
('storage_class', models.CharField(choices=[('HDD', 'HDD'), ('SSD', 'SSD')], default='SSD', max_length=32)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32)),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='VMHost',
fields=[
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('hostname', models.CharField(max_length=253, unique=True)),
('physical_cores', models.IntegerField(default=0)),
('usable_cores', models.IntegerField(default=0)),
('usable_ram_in_gb', models.FloatField(default=0)),
('status', models.CharField(choices=[('pending', 'Pending'), ('creating', 'Creating'), ('active', 'Active'), ('disabled', 'Disabled'), ('unusable', 'Unusable'), ('deleted', 'Deleted')], default='pending', max_length=32)),
('vms', models.TextField(default='')),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32)),
('vmcluster', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMCluster')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='VMProduct',
fields=[
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('ACTIVE', 'Active'), ('DELETED', 'Deleted')], default='PENDING', max_length=32)),
('name', models.CharField(max_length=32)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32)),
('name', models.CharField(blank=True, max_length=32, null=True)),
('cores', models.IntegerField()),
('ram_in_gb', models.FloatField()),
('vmid', models.IntegerField(null=True)),
('order', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('vmcluster', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMCluster')),
('vmhost', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMHost')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='VMWithOSProduct',
fields=[
('vmproduct_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='uncloud_vm.VMProduct')),
],
options={
'abstract': False,
},
bases=('uncloud_vm.vmproduct',),
),
migrations.CreateModel(
name='VMSnapshotProduct',
fields=[
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('ACTIVE', 'Active'), ('DELETED', 'Deleted')], default='PENDING', max_length=32)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32)),
('gb_ssd', models.FloatField(editable=False)),
('gb_hdd', models.FloatField(editable=False)),
('order', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('vm', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMProduct')),
('vm', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='snapshots', to='uncloud_vm.VMProduct')),
],
options={
'abstract': False,
@ -98,11 +110,28 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='VMDiskProduct',
fields=[
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32)),
('size_in_gb', models.FloatField(blank=True)),
('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMDiskImageProduct')),
('order', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('vm', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMProduct')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='VMWithOSProduct',
fields=[
('vmproduct_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='uncloud_vm.VMProduct')),
('primary_disk', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMDiskProduct')),
],
options={
'abstract': False,
},
bases=('uncloud_vm.vmproduct',),
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-05 13:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='vmdiskimageproduct',
name='storage_class',
field=models.CharField(choices=[('HDD', 'HDD'), ('SSD', 'SSD')], default='SSD', max_length=32),
),
migrations.AlterField(
model_name='vmproduct',
name='name',
field=models.CharField(blank=True, max_length=32, null=True),
),
]

View File

@ -1,17 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-05 13:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0002_auto_20200305_1321'),
]
operations = [
migrations.RemoveField(
model_name='vmhost',
name='vms',
),
]

View File

@ -1,17 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-17 14:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0003_remove_vmhost_vms'),
]
operations = [
migrations.RemoveField(
model_name='vmproduct',
name='vmid',
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-09 12:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0004_remove_vmproduct_vmid'),
]
operations = [
migrations.AddField(
model_name='vmproduct',
name='primary_disk',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMDiskProduct'),
),
]

View File

@ -1,25 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-09 12:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0001_initial'),
('uncloud_vm', '0004_vmproduct_primary_disk'),
]
operations = [
migrations.AddField(
model_name='vmdiskproduct',
name='order',
field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order'),
),
migrations.AddField(
model_name='vmdiskproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('ACTIVE', 'Active'), ('DELETED', 'Deleted')], default='PENDING', max_length=32),
),
]

View File

@ -1,50 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-21 10:58
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0005_auto_20200309_1258'),
]
operations = [
migrations.AddField(
model_name='vmdiskimageproduct',
name='extra_data',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True),
),
migrations.AddField(
model_name='vmdiskproduct',
name='extra_data',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True),
),
migrations.AddField(
model_name='vmhost',
name='extra_data',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True),
),
migrations.AddField(
model_name='vmproduct',
name='extra_data',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True),
),
migrations.AddField(
model_name='vmsnapshotproduct',
name='extra_data',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True),
),
migrations.AlterField(
model_name='vmdiskproduct',
name='vm',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='disks', to='uncloud_vm.VMProduct'),
),
migrations.AlterField(
model_name='vmsnapshotproduct',
name='vm',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='snapshots', to='uncloud_vm.VMProduct'),
),
]

View File

@ -1,57 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-22 17:58
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0005_auto_20200321_1058'),
]
operations = [
migrations.CreateModel(
name='VMCluster',
fields=[
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=128, unique=True)),
],
options={
'abstract': False,
},
),
migrations.AlterField(
model_name='vmdiskimageproduct',
name='is_public',
field=models.BooleanField(default=False, editable=False),
),
migrations.AlterField(
model_name='vmdiskimageproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('ACTIVE', 'Active'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
migrations.AlterField(
model_name='vmhost',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('ACTIVE', 'Active'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
migrations.AlterField(
model_name='vmproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('ACTIVE', 'Active'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
migrations.AlterField(
model_name='vmsnapshotproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('ACTIVE', 'Active'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
migrations.AddField(
model_name='vmproduct',
name='vmcluster',
field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMCluster'),
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-22 18:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0006_auto_20200322_1758'),
]
operations = [
migrations.AddField(
model_name='vmhost',
name='vmcluster',
field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMCluster'),
),
]

View File

@ -1,33 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-03 17:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0007_vmhost_vmcluster'),
]
operations = [
migrations.AlterField(
model_name='vmdiskimageproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
migrations.AlterField(
model_name='vmhost',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
migrations.AlterField(
model_name='vmproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
migrations.AlterField(
model_name='vmsnapshotproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-17 05:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0008_auto_20200403_1727'),
]
operations = [
migrations.AlterField(
model_name='vmproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32),
),
migrations.AlterField(
model_name='vmsnapshotproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32),
),
]

View File

@ -1,14 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-13 08:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0004_remove_vmproduct_vmid'),
('uncloud_vm', '0008_auto_20200403_1727'),
]
operations = [
]

View File

@ -1,24 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-13 09:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0009_merge_20200413_0857'),
]
operations = [
migrations.AlterField(
model_name='vmdiskproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='PENDING', max_length=32),
),
migrations.AlterField(
model_name='vmdiskproduct',
name='vm',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMProduct'),
),
]

View File

@ -1,14 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-18 06:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0009_auto_20200417_0551'),
('uncloud_vm', '0010_auto_20200413_0924'),
]
operations = [
]

View File

@ -1,18 +0,0 @@
# Generated by Django 3.0.5 on 2020-04-18 06:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0011_merge_20200418_0641'),
]
operations = [
migrations.AlterField(
model_name='vmdiskproduct',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32),
),
]

View File

@ -1,17 +0,0 @@
# Generated by Django 3.0.5 on 2020-05-02 19:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0012_auto_20200418_0641'),
]
operations = [
migrations.RemoveField(
model_name='vmproduct',
name='primary_disk',
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 3.0.6 on 2020-05-08 14:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_vm', '0013_remove_vmproduct_primary_disk'),
]
operations = [
migrations.AddField(
model_name='vmwithosproduct',
name='primary_disk',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_vm.VMDiskProduct'),
),
]