# Generated by Django 3.0.3 on 2020-02-11 09:02

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


class Migration(migrations.Migration):

    dependencies = [
        ('kd', '0138_auto_20200211_0812'),
    ]

    operations = [
        migrations.AlterField(
            model_name='lotsman_document_attr_cross',
            name='parent_document',
            field=isc_common.fields.related.ForeignKeyCascade(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='Lotsman_document_attr_cross_parent_doc', to='kd.Lotsman_documents_hierarcy'),
        ),
        migrations.AlterUniqueTogether(
            name='lotsman_document_attr_cross',
            unique_together=set(),
        ),
        migrations.AddConstraint(
            model_name='lotsman_document_attr_cross',
            constraint=models.CheckConstraint(check=models.Q(_negated=True, document=django.db.models.expressions.F('parent_document')), name='Lotsman_document_attr_cross_not_circulate_refs'),
        ),
        migrations.AddConstraint(
            model_name='lotsman_document_attr_cross',
            constraint=models.UniqueConstraint(condition=models.Q(parent_document=None), fields=('attribute', 'document'), name='Lotsman_document_attr_cross_unique_constraint_0'),
        ),
        migrations.AddConstraint(
            model_name='lotsman_document_attr_cross',
            constraint=models.UniqueConstraint(fields=('attribute', 'document', 'parent_document'), name='Lotsman_document_attr_cross_unique_constraint_1'),
        ),
    ]
