# Generated by Django 3.1.4 on 2020-12-31 21:08

import dfam_api_app.models
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='DataFileEntity',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('display_name', models.CharField(max_length=100)),
                ('description', models.CharField(blank=True, max_length=255, null=True)),
            ],
            options={
                'verbose_name': 'Data File (row) Entity',
                'verbose_name_plural': 'Data File (row) Entities',
            },
        ),
        migrations.CreateModel(
            name='DataFileEntityColumn',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('display_name', models.CharField(max_length=100)),
                ('column_name', models.CharField(max_length=255)),
                ('description', models.CharField(blank=True, max_length=255, null=True)),
                ('data_file_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='column', to='dfam_api_app.datafileentity')),
            ],
            options={
                'verbose_name': 'Data File (row) Entity Column',
                'verbose_name_plural': 'Data File (row) Entity Columns',
            },
        ),
        migrations.CreateModel(
            name='DataFileSub',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.CharField(max_length=32, unique=True)),
                ('file', models.FileField(upload_to=dfam_api_app.models.data_file_sub_upload_to)),
                ('data_file_sub_state_description', models.CharField(blank=True, max_length=255, null=True)),
                ('submitter', models.CharField(max_length=255)),
                ('submitted', models.DateTimeField(auto_now=True)),
                ('updated', models.DateTimeField()),
            ],
            options={
                'verbose_name': 'Data File Submission',
                'verbose_name_plural': 'Data File Submissions',
            },
        ),
        migrations.CreateModel(
            name='DataFileSubEntity',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('novel', models.BooleanField(default=False)),
                ('data_file_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dfam_api_app.datafileentity')),
                ('data_file_sub', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='entity', to='dfam_api_app.datafilesub')),
            ],
            options={
                'verbose_name': 'Data File Submission Entity',
                'verbose_name_plural': 'Data File Submission Entities',
            },
        ),
        migrations.CreateModel(
            name='DataFileSubState',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('display_name', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Data File Submission State',
                'verbose_name_plural': 'Data File submission States',
            },
        ),
        migrations.CreateModel(
            name='DataFileType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('display_name', models.CharField(max_length=100)),
                ('description', models.CharField(blank=True, max_length=255, null=True)),
            ],
            options={
                'verbose_name': 'Data File Type',
                'verbose_name_plural': 'Data File Types',
            },
        ),
        migrations.CreateModel(
            name='RemoteSetEntity',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('remote_key', models.CharField(max_length=100)),
                ('data_file_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dfam_api_app.datafileentity')),
                ('data_file_sub', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='matching_set_entity', to='dfam_api_app.datafilesub')),
            ],
            options={
                'verbose_name': 'Remote Set Entity',
                'verbose_name_plural': 'Remote Set Entities',
            },
        ),
        migrations.CreateModel(
            name='UserDataFileType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data_file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='data_file_type_user', to='dfam_api_app.datafileentity')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_data_file_type', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'User <-> Data File Type',
                'verbose_name_plural': 'User(s) <-> Data File Type(s)',
            },
        ),
        migrations.CreateModel(
            name='RemoteSetEntityColVal',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('column_value', models.CharField(max_length=255)),
                ('data_file_entity_column', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dfam_api_app.datafileentitycolumn')),
                ('remote_set_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='col_val', to='dfam_api_app.remotesetentity')),
            ],
            options={
                'verbose_name': 'Remote Set Entity Column Value',
                'verbose_name_plural': 'Remote set Entity Column Values',
            },
        ),
        migrations.CreateModel(
            name='DataFileSubEntityRemoteSetEntityEquiv',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data_file_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='equiv', to='dfam_api_app.datafileentity')),
                ('remote_set_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dfam_api_app.remotesetentity')),
            ],
            options={
                'verbose_name': 'Data File Submission Entity Remote Set Entity Equivalent',
                'verbose_name_plural': 'Data File Submission Entity Remote Set Entity Equivalents',
            },
        ),
        migrations.CreateModel(
            name='DataFileSubEntityRemoteSetEntityAutoMatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('match_score', models.PositiveIntegerField()),
                ('data_file_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='auto_match', to='dfam_api_app.datafileentity')),
                ('remote_set_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dfam_api_app.remotesetentity')),
            ],
            options={
                'verbose_name': 'Data File Submission Entity Remote Set Entity Auto Match',
                'verbose_name_plural': 'Data File Submission Entity Remote Set Entity Auto Matches',
            },
        ),
        migrations.CreateModel(
            name='DataFileSubEntityLine',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('line_number', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1)])),
                ('data_file_sub_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='line_col_val', to='dfam_api_app.datafilesubentity')),
            ],
            options={
                'verbose_name': 'Data File Submission Entity Line',
                'verbose_name_plural': 'Data File Submission Entity Lines',
            },
        ),
        migrations.CreateModel(
            name='DataFileSubEntityColVal',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('column_value', models.CharField(max_length=255)),
                ('data_file_entity_column', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dfam_api_app.datafileentitycolumn')),
                ('data_file_sub_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='col_val', to='dfam_api_app.datafilesubentity')),
            ],
            options={
                'verbose_name': 'Data File Submission Entity Column Value',
                'verbose_name_plural': 'Data File Submission Entity Column Values',
            },
        ),
        migrations.AddField(
            model_name='datafilesub',
            name='data_file_sub_state',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='data_file_state_sub', to='dfam_api_app.datafilesubstate'),
        ),
        migrations.AddField(
            model_name='datafilesub',
            name='data_file_type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='data_file_type_sub', to='dfam_api_app.datafiletype'),
        ),
        migrations.AddField(
            model_name='datafilesub',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owned_data_file_state_sub', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='datafileentity',
            name='data_file_type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='entity', to='dfam_api_app.datafiletype'),
        ),
        migrations.AddConstraint(
            model_name='userdatafiletype',
            constraint=models.UniqueConstraint(fields=('user', 'data_file_type'), name='udft_u_dft'),
        ),
        migrations.AddConstraint(
            model_name='remotesetentitycolval',
            constraint=models.UniqueConstraint(fields=('remote_set_entity', 'data_file_entity_column'), name='rsecv_dfse_dfec'),
        ),
        migrations.AddConstraint(
            model_name='remotesetentity',
            constraint=models.UniqueConstraint(fields=('data_file_sub', 'data_file_entity'), name='rse_dfs_dfe'),
        ),
        migrations.AddConstraint(
            model_name='datafilesubentityremotesetentityequiv',
            constraint=models.UniqueConstraint(fields=('data_file_entity', 'remote_set_entity'), name='dfsersee_dfe_rse'),
        ),
        migrations.AddConstraint(
            model_name='datafilesubentityremotesetentityautomatch',
            constraint=models.UniqueConstraint(fields=('data_file_entity', 'remote_set_entity'), name='dfserseam_dfe_rse'),
        ),
        migrations.AddConstraint(
            model_name='datafilesubentityline',
            constraint=models.UniqueConstraint(fields=('data_file_sub_entity', 'line_number'), name='dfsel_dfse_ln'),
        ),
        migrations.AddConstraint(
            model_name='datafilesubentitycolval',
            constraint=models.UniqueConstraint(fields=('data_file_sub_entity', 'data_file_entity_column'), name='dfsecv_dfse_dfec'),
        ),
        migrations.AddConstraint(
            model_name='datafilesubentity',
            constraint=models.UniqueConstraint(fields=('data_file_sub', 'data_file_entity'), name='dfse_dfs_dfe'),
        ),
        migrations.AddConstraint(
            model_name='datafileentitycolumn',
            constraint=models.UniqueConstraint(fields=('data_file_entity', 'name', 'column_name'), name='dfec_dfe_n_cn'),
        ),
        migrations.AddConstraint(
            model_name='datafileentity',
            constraint=models.UniqueConstraint(fields=('data_file_type', 'name'), name='dfe_dft_n'),
        ),
    ]
