# Generated by Django 2.1.5 on 2019-08-14 07:19

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import okbv.models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Bus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bus_nr', models.CharField(max_length=20, null=True)),
                ('lub_nr', models.CharField(max_length=20)),
                ('quantity', models.IntegerField(default=0)),
                ('t1', models.DateField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name='NachtragFromDb',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('version', models.IntegerField()),
                ('type', models.CharField(max_length=10)),
                ('status', models.CharField(max_length=30)),
                ('user', models.CharField(max_length=10, null=True)),
                ('status_date', models.DateField(null=True)),
                ('bus', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='okbv.Bus')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='NachtragFromDbFromFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('version', models.IntegerField()),
                ('type', models.CharField(max_length=10)),
                ('status', models.CharField(max_length=30)),
                ('user', models.CharField(max_length=10, null=True)),
                ('status_date', models.DateField(null=True)),
                ('bus', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='okbv.Bus')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OkbvFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('file', models.FileField(upload_to='uploads/okbv', validators=[okbv.models.FileExtensionValidator_PL(allowed_extensions=['csv'])])),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='bus',
            name='from_file',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='okbv.OkbvFile'),
        ),
        migrations.AlterUniqueTogether(
            name='okbvfile',
            unique_together={('owner', 'name')},
        ),
        migrations.AlterUniqueTogether(
            name='bus',
            unique_together={('from_file', 'lub_nr')},
        ),
    ]
