# Generated by Django 2.2.14 on 2021-03-18 02:54

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import uuid


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('api', '0002_measurementconfig_measurementvolumes'),
    ]

    operations = [
        migrations.CreateModel(
            name='Bill',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('resource_type', models.IntegerField(choices=[(1, 'cpu'), (2, 'memory'), (3, 'volume'), (4, 'network')], db_index=True)),
                ('price_unit', models.IntegerField()),
                ('price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('quantity', models.DecimalField(decimal_places=2, max_digits=12)),
                ('total_price', models.DecimalField(decimal_places=2, max_digits=12)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ChargeRule',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=64, unique=True)),
                ('resource_type', models.IntegerField(choices=[(1, 'cpu'), (2, 'memory'), (3, 'volume'), (4, 'network')], db_index=True)),
                ('price_unit', models.IntegerField()),
                ('price', models.DecimalField(decimal_places=2, max_digits=12)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Config',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('container_type', models.CharField(max_length=63)),
                ('cpu', models.PositiveIntegerField()),
                ('memory', models.PositiveIntegerField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Funding',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('operator', jsonfield.fields.JSONField(null=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('credit', models.DecimalField(decimal_places=2, max_digits=12)),
                ('trade_type', models.CharField(db_index=True, max_length=63)),
                ('trade_credit', models.DecimalField(decimal_places=2, max_digits=12)),
                ('remark', models.TextField(blank=True, null=True)),
                ('billing', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Bill')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Instance',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('container_type', models.CharField(max_length=63)),
                ('container_count', models.PositiveIntegerField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('code', models.IntegerField(choices=[(1, 'bill'), (2, 'arrearage')], db_index=True)),
                ('sender', models.CharField(max_length=32)),
                ('body', models.CharField(db_index=True, max_length=63)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Network',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('pod_name', models.CharField(max_length=63)),
                ('rx_bytes', models.PositiveIntegerField()),
                ('tx_bytes', models.PositiveIntegerField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Resource',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('name', models.CharField(max_length=63)),
                ('plan', models.CharField(max_length=63)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Volume',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('name', models.CharField(max_length=63)),
                ('size', models.PositiveIntegerField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.RemoveField(
            model_name='measurementvolumes',
            name='cluster',
        ),
        migrations.AlterField(
            model_name='cluster',
            name='admin',
            field=models.CharField(blank=True, max_length=64, null=True),
        ),
        migrations.AlterField(
            model_name='cluster',
            name='passwd',
            field=models.CharField(blank=True, max_length=128, null=True),
        ),
        migrations.DeleteModel(
            name='MeasurementConfig',
        ),
        migrations.DeleteModel(
            name='MeasurementVolumes',
        ),
        migrations.AddField(
            model_name='volume',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='resource',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='network',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='instance',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='funding',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='funding',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='config',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='bill',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='bill',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
    ]

# Generated by Django 2.2.14 on 2021-03-18 02:54

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import uuid


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('api', '0002_measurementconfig_measurementvolumes'),
    ]

    operations = [
        migrations.CreateModel(
            name='Bill',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('resource_type', models.IntegerField(choices=[(1, 'cpu'), (2, 'memory'), (3, 'volume'), (4, 'network')], db_index=True)),
                ('price_unit', models.IntegerField()),
                ('price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('quantity', models.DecimalField(decimal_places=2, max_digits=12)),
                ('total_price', models.DecimalField(decimal_places=2, max_digits=12)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ChargeRule',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=64, unique=True)),
                ('resource_type', models.IntegerField(choices=[(1, 'cpu'), (2, 'memory'), (3, 'volume'), (4, 'network')], db_index=True)),
                ('price_unit', models.IntegerField()),
                ('price', models.DecimalField(decimal_places=2, max_digits=12)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Config',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('container_type', models.CharField(max_length=63)),
                ('cpu', models.PositiveIntegerField()),
                ('memory', models.PositiveIntegerField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Funding',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('operator', jsonfield.fields.JSONField(null=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('credit', models.DecimalField(decimal_places=2, max_digits=12)),
                ('trade_type', models.CharField(db_index=True, max_length=63)),
                ('trade_credit', models.DecimalField(decimal_places=2, max_digits=12)),
                ('remark', models.TextField(blank=True, null=True)),
                ('billing', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Bill')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Instance',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('container_type', models.CharField(max_length=63)),
                ('container_count', models.PositiveIntegerField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('code', models.IntegerField(choices=[(1, 'bill'), (2, 'arrearage')], db_index=True)),
                ('sender', models.CharField(max_length=32)),
                ('body', models.CharField(db_index=True, max_length=63)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Network',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('pod_name', models.CharField(max_length=63)),
                ('rx_bytes', models.PositiveIntegerField()),
                ('tx_bytes', models.PositiveIntegerField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Resource',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('name', models.CharField(max_length=63)),
                ('plan', models.CharField(max_length=63)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Volume',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('app_id', models.CharField(db_index=True, max_length=63)),
                ('owner_id', models.CharField(db_index=True, max_length=63)),
                ('timestamp', models.FloatField(db_index=True)),
                ('name', models.CharField(max_length=63)),
                ('size', models.PositiveIntegerField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.RemoveField(
            model_name='measurementvolumes',
            name='cluster',
        ),
        migrations.AlterField(
            model_name='cluster',
            name='admin',
            field=models.CharField(blank=True, max_length=64, null=True),
        ),
        migrations.AlterField(
            model_name='cluster',
            name='passwd',
            field=models.CharField(blank=True, max_length=128, null=True),
        ),
        migrations.DeleteModel(
            name='MeasurementConfig',
        ),
        migrations.DeleteModel(
            name='MeasurementVolumes',
        ),
        migrations.AddField(
            model_name='volume',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='resource',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='network',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='instance',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='funding',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='funding',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='config',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='bill',
            name='cluster',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Cluster'),
        ),
        migrations.AddField(
            model_name='bill',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
    ]

# Generated by Django 2.2.14 on 2021-03-18 02:54