# Generated by Django 3.0.8 on 2020-07-06 10:21

import bitfield.models
from django.db import migrations, models
import django.db.models.deletion
import isc_common.fields.related


class Migration(migrations.Migration):

    dependencies = [
        ('ckk', '0229_locations_view'),
        ('production', '0268_auto_20200628_0808'),
    ]

    operations = [
        migrations.RemoveConstraint(
            model_name='operation_def_resources',
            name='Operation_def_resources_unique_constraint_0',
        ),
        migrations.RemoveConstraint(
            model_name='operation_def_resources',
            name='Operation_def_resources_unique_constraint_1',
        ),
        migrations.RemoveConstraint(
            model_name='operation_def_resources',
            name='Operation_def_resources_unique_constraint_2',
        ),
        migrations.RemoveConstraint(
            model_name='operation_def_resources',
            name='Operation_def_resources_unique_constraint_3',
        ),
        migrations.RemoveConstraint(
            model_name='operation_resources',
            name='Operation_resources_unique_constraint_0',
        ),
        migrations.RemoveConstraint(
            model_name='operation_resources',
            name='Operation_resources_unique_constraint_1',
        ),
        migrations.RemoveConstraint(
            model_name='operation_resources',
            name='Operation_resources_unique_constraint_2',
        ),
        migrations.RemoveConstraint(
            model_name='operation_resources',
            name='Operation_resources_unique_constraint_3',
        ),
        migrations.RemoveConstraint(
            model_name='operations_template_resource',
            name='Operations_template_resource_unique_constraint_0',
        ),
        migrations.RemoveConstraint(
            model_name='operations_template_resource',
            name='Operations_template_resource_unique_constraint_1',
        ),
        migrations.RemoveConstraint(
            model_name='operations_template_resource',
            name='Operations_template_resource_unique_constraint_2',
        ),
        migrations.RemoveConstraint(
            model_name='operations_template_resource',
            name='Operations_template_resource_unique_constraint_3',
        ),
        migrations.AddField(
            model_name='operation_def_resources',
            name='location_fin',
            field=isc_common.fields.related.ForeignKeyProtect(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Operation_def_resources_location_fin', to='ckk.Locations'),
        ),
        migrations.AddField(
            model_name='operation_resources',
            name='location_fin',
            field=isc_common.fields.related.ForeignKeyProtect(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Operation_resources_location_fin', to='ckk.Locations'),
        ),
        migrations.AddField(
            model_name='operations_template_resource',
            name='location_fin',
            field=isc_common.fields.related.ForeignKeyProtect(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Operations_template_resource_location_fin', to='ckk.Locations'),
        ),
        migrations.AlterField(
            model_name='operation_def_resources',
            name='location',
            field=isc_common.fields.related.ForeignKeyProtect(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Operation_def_resources_location', to='ckk.Locations'),
        ),
        migrations.AlterField(
            model_name='operation_resources',
            name='location',
            field=isc_common.fields.related.ForeignKeyProtect(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Operation_resources_location', to='ckk.Locations'),
        ),
        migrations.AlterField(
            model_name='operations',
            name='props',
            field=bitfield.models.BitField((('assemly', 'Операция комплектации'), ('made_common_form', 'Формировать общий документ'), ('transportation', 'Операция транспортировки')), db_index=True, default=0),
        ),
        migrations.AlterField(
            model_name='operations_template_resource',
            name='location',
            field=isc_common.fields.related.ForeignKeyProtect(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Operations_template_resource_location', to='ckk.Locations'),
        ),
        migrations.AddConstraint(
            model_name='operation_def_resources',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('location_fin', None), ('resource', None)), fields=('operation',), name='Operation_def_resources_unique_constraint_0'),
        ),
        migrations.AddConstraint(
            model_name='operation_def_resources',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('location_fin', None)), fields=('operation', 'resource'), name='Operation_def_resources_unique_constraint_1'),
        ),
        migrations.AddConstraint(
            model_name='operation_def_resources',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('resource', None)), fields=('location_fin', 'operation'), name='Operation_def_resources_unique_constraint_2'),
        ),
        migrations.AddConstraint(
            model_name='operation_def_resources',
            constraint=models.UniqueConstraint(condition=models.Q(location=None), fields=('location_fin', 'operation', 'resource'), name='Operation_def_resources_unique_constraint_3'),
        ),
        migrations.AddConstraint(
            model_name='operation_def_resources',
            constraint=models.UniqueConstraint(condition=models.Q(('location_fin', None), ('resource', None)), fields=('location', 'operation'), name='Operation_def_resources_unique_constraint_4'),
        ),
        migrations.AddConstraint(
            model_name='operation_def_resources',
            constraint=models.UniqueConstraint(condition=models.Q(location_fin=None), fields=('location', 'operation', 'resource'), name='Operation_def_resources_unique_constraint_5'),
        ),
        migrations.AddConstraint(
            model_name='operation_def_resources',
            constraint=models.UniqueConstraint(condition=models.Q(resource=None), fields=('location', 'location_fin', 'operation'), name='Operation_def_resources_unique_constraint_6'),
        ),
        migrations.AddConstraint(
            model_name='operation_def_resources',
            constraint=models.UniqueConstraint(fields=('location', 'location_fin', 'operation', 'resource'), name='Operation_def_resources_unique_constraint_7'),
        ),
        migrations.AddConstraint(
            model_name='operation_resources',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('location_fin', None), ('resource', None)), fields=('operationitem',), name='Operation_resources_unique_constraint_0'),
        ),
        migrations.AddConstraint(
            model_name='operation_resources',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('location_fin', None)), fields=('operationitem', 'resource'), name='Operation_resources_unique_constraint_1'),
        ),
        migrations.AddConstraint(
            model_name='operation_resources',
            constraint=models.UniqueConstraint(condition=models.Q(('location_fin', None), ('resource', None)), fields=('location', 'operationitem'), name='Operation_resources_unique_constraint_2'),
        ),
        migrations.AddConstraint(
            model_name='operation_resources',
            constraint=models.UniqueConstraint(condition=models.Q(location_fin=None), fields=('location', 'operationitem', 'resource'), name='Operation_resources_unique_constraint_3'),
        ),
        migrations.AddConstraint(
            model_name='operation_resources',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('resource', None)), fields=('location_fin', 'operationitem'), name='Operation_resources_unique_constraint_4'),
        ),
        migrations.AddConstraint(
            model_name='operation_resources',
            constraint=models.UniqueConstraint(condition=models.Q(location=None), fields=('location_fin', 'operationitem', 'resource'), name='Operation_resources_unique_constraint_5'),
        ),
        migrations.AddConstraint(
            model_name='operation_resources',
            constraint=models.UniqueConstraint(condition=models.Q(resource=None), fields=('location', 'location_fin', 'operationitem'), name='Operation_resources_unique_constraint_6'),
        ),
        migrations.AddConstraint(
            model_name='operation_resources',
            constraint=models.UniqueConstraint(fields=('location', 'location_fin', 'operationitem', 'resource'), name='Operation_resources_unique_constraint_7'),
        ),
        migrations.AddConstraint(
            model_name='operations_template_resource',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('location_fin', None), ('resource', None)), fields=('template',), name='Operations_template_resource_unique_constraint_0'),
        ),
        migrations.AddConstraint(
            model_name='operations_template_resource',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('location_fin', None)), fields=('resource', 'template'), name='Operations_template_resource_unique_constraint_1'),
        ),
        migrations.AddConstraint(
            model_name='operations_template_resource',
            constraint=models.UniqueConstraint(condition=models.Q(('location_fin', None), ('resource', None)), fields=('location', 'template'), name='Operations_template_resource_unique_constraint_2'),
        ),
        migrations.AddConstraint(
            model_name='operations_template_resource',
            constraint=models.UniqueConstraint(condition=models.Q(location_fin=None), fields=('location', 'resource', 'template'), name='Operations_template_resource_unique_constraint_3'),
        ),
        migrations.AddConstraint(
            model_name='operations_template_resource',
            constraint=models.UniqueConstraint(condition=models.Q(('location', None), ('resource', None)), fields=('location_fin', 'template'), name='Operations_template_resource_unique_constraint_4'),
        ),
        migrations.AddConstraint(
            model_name='operations_template_resource',
            constraint=models.UniqueConstraint(condition=models.Q(location=None), fields=('location_fin', 'resource', 'template'), name='Operations_template_resource_unique_constraint_5'),
        ),
        migrations.AddConstraint(
            model_name='operations_template_resource',
            constraint=models.UniqueConstraint(condition=models.Q(resource=None), fields=('location', 'location_fin', 'template'), name='Operations_template_resource_unique_constraint_6'),
        ),
        migrations.AddConstraint(
            model_name='operations_template_resource',
            constraint=models.UniqueConstraint(fields=('location', 'location_fin', 'resource', 'template'), name='Operations_template_resource_unique_constraint_7'),
        ),
    ]
