# Generated by Django 2.1 on 2018-09-04 23:07

from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Asset',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Clearance',
            fields=[
                ('clearance_id', models.TextField(primary_key=True, serialize=False)),
                ('created_by', models.TextField()),
                ('state', models.TextField()),
                ('message', models.TextField()),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
            ],
        ),
        migrations.CreateModel(
            name='CorsModel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cors', models.CharField(max_length=255)),
            ],
            options={
                'db_table': 'corsheaders_corsmodel',
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Drone',
            fields=[
                ('id', models.TextField(primary_key=True, serialize=False)),
                ('description', models.TextField()),
                ('manufacturer', models.TextField()),
                ('type', models.TextField()),
                ('color', models.TextField()),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Mission',
            fields=[
                ('id', models.TextField(primary_key=True, serialize=False)),
                ('title', models.TextField()),
                ('type', models.TextField()),
                ('description', models.TextField()),
                ('area', django.contrib.gis.db.models.fields.PolygonField(default='POLYGON EMPTY', srid=4326)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('starts_at', models.DateTimeField()),
                ('ends_at', models.DateTimeField()),
                ('clearance', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='icarus_backend.Clearance')),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='asset',
            name='drone',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='icarus_backend.Drone'),
        ),
        migrations.AddField(
            model_name='asset',
            name='mission',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='icarus_backend.Mission'),
        ),
        migrations.AddField(
            model_name='asset',
            name='operator',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='asset',
            unique_together={('drone', 'mission')},
        ),
    ]
