# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-07-08 11:57
from django.db import migrations, models
import django.db.models.deletion
import waldur_core.core.fields
import waldur_core.core.models
import waldur_core.core.validators


class Migration(migrations.Migration):

    dependencies = [
        ('structure', '0009_project_is_removed'),
        ('waldur_vmware', '0010_virtualmachine_networks'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomerDatastore',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.Customer')),
            ],
        ),
        migrations.CreateModel(
            name='Datastore',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backend_id', models.CharField(db_index=True, max_length=255)),
                ('type', models.CharField(max_length=255)),
                ('capacity', models.PositiveIntegerField(blank=True, help_text='Capacity, in MB.', null=True)),
                ('free_space', models.PositiveIntegerField(blank=True, help_text='Available space, in MB.', null=True)),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            options={
                'abstract': False,
            },
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.AddField(
            model_name='customerdatastore',
            name='datastore',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='waldur_vmware.Datastore'),
        ),
        migrations.AddField(
            model_name='virtualmachine',
            name='datastore',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='waldur_vmware.Datastore'),
        ),
        migrations.AlterUniqueTogether(
            name='datastore',
            unique_together=set([('settings', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='customerdatastore',
            unique_together=set([('customer', 'datastore')]),
        ),
    ]
