# Generated by Django 3.1.7 on 2021-03-09 09:19

import bitfield.models
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models

import isc_common.fields.related


class Migration(migrations.Migration):
    dependencies = [
        # ('competitions', '0158_auto_20210309_0833'),
        ('isc_common', '0077_image_types_images_links_text_informations'),
    ]

    operations = [
        migrations.CreateModel(
            name='Users_images',
            fields=[
                ('id', models.BigAutoField(primary_key=True, serialize=False, verbose_name='Идентификатор')),
                ('deleted_at', models.DateTimeField(blank=True, db_index=True, null=True, verbose_name='Дата мягкого удаления')),
                ('editing', models.BooleanField(default=True, verbose_name='Возможность редактирования')),
                ('deliting', models.BooleanField(default=True, verbose_name='Возможность удаления')),
                ('lastmodified', models.DateTimeField(db_index=True, default=django.utils.timezone.now, editable=False, verbose_name='Последнее обновление')),
                ('props', bitfield.models.BitField((('main_photo', 'main_photo'),), db_index=True, default=0)),
                ('club', isc_common.fields.related.ForeignKeyProtect(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='competitions.clubs')),
                ('image', isc_common.fields.related.ForeignKeyProtect(on_delete=django.db.models.deletion.PROTECT, to='isc_common.images')),
                ('main_model', isc_common.fields.related.ForeignKeyProtect(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Кросс таблица',
            },
        ),
        migrations.AddConstraint(
            model_name='users_images',
            constraint=models.UniqueConstraint(condition=models.Q(club=None), fields=('image', 'main_model', 'props'), name='Users_images_unique_constraint_2'),
        ),
        migrations.AddConstraint(
            model_name='users_images',
            constraint=models.UniqueConstraint(fields=('club', 'image', 'main_model', 'props'), name='Users_images_unique_constraint_3'),
        ),
    ]
