# Generated by Django 4.0.3 on 2022-04-07 09:25

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('metadata', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='RollingClass',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identifier', models.CharField(max_length=128)),
                ('description', models.CharField(blank=True, max_length=256)),
                ('company', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='metadata.company')),
                ('manufacturer', models.ForeignKey(blank=True, limit_choices_to={'category': 'real'}, null=True, on_delete=django.db.models.deletion.CASCADE, to='metadata.manufacturer')),
                ('type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='metadata.rollingstocktype')),
            ],
            options={
                'verbose_name': 'Class',
                'verbose_name_plural': 'Classes',
                'ordering': ['company', 'identifier'],
            },
        ),
        migrations.CreateModel(
            name='RollingStock',
            fields=[
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('road_number', models.CharField(max_length=128)),
                ('sku', models.CharField(blank=True, max_length=32)),
                ('address', models.SmallIntegerField(blank=True, default=None, null=True)),
                ('era', models.CharField(blank=True, max_length=32)),
                ('production_year', models.SmallIntegerField(blank=True, null=True)),
                ('purchase_date', models.DateField(blank=True, null=True)),
                ('notes', models.TextField(blank=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True)),
                ('updated_time', models.DateTimeField(auto_now=True)),
                ('decoder', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='metadata.decoder')),
                ('manufacturer', models.ForeignKey(blank=True, limit_choices_to={'category': 'model'}, null=True, on_delete=django.db.models.deletion.CASCADE, to='metadata.manufacturer')),
                ('rolling_class', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='roster.rollingclass', verbose_name='Class')),
                ('scale', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='metadata.scale')),
                ('tags', models.ManyToManyField(blank=True, related_name='rolling_stock', to='metadata.tag')),
            ],
            options={
                'verbose_name_plural': 'Rolling stock',
                'ordering': ['rolling_class', 'road_number'],
            },
        ),
        migrations.CreateModel(
            name='RollingStockProperty',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(max_length=256)),
                ('property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='metadata.property')),
                ('rolling_stock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='roster.rollingstock')),
            ],
            options={
                'verbose_name_plural': 'Properties',
            },
        ),
        migrations.CreateModel(
            name='RollingClassProperty',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(max_length=256)),
                ('property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='metadata.property')),
                ('rolling_class', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='roster.rollingclass', verbose_name='Class')),
            ],
            options={
                'verbose_name_plural': 'Properties',
            },
        ),
        migrations.CreateModel(
            name='RollingStockImage',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(blank=True, null=True, upload_to='images/')),
                ('rolling_stock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='roster.rollingstock')),
            ],
            options={
                'unique_together': {('rolling_stock', 'image')},
            },
        ),
        migrations.CreateModel(
            name='RollingStockDocument',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, max_length=128)),
                ('file', models.FileField(blank=True, null=True, upload_to='files/')),
                ('rolling_stock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='roster.rollingstock')),
            ],
            options={
                'unique_together': {('rolling_stock', 'file')},
            },
        ),
    ]
