# Generated by Django 3.1.3 on 2020-11-28 06:08

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0012_merge_20201128_0603'),
    ]

    operations = [
        migrations.CreateModel(
            name='Chat',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
        ),
        migrations.AlterModelOptions(
            name='request',
            options={},
        ),
        migrations.AlterField(
            model_name='request',
            name='authors',
            field=models.ManyToManyField(blank=True, null=True, to=settings.AUTH_USER_MODEL, verbose_name='Авторы'),
        ),
        migrations.AlterField(
            model_name='request',
            name='digital_categories',
            field=models.ManyToManyField(blank=True, null=True, to='api.DigitalCategory', verbose_name='Цифровые Категории'),
        ),
        migrations.AlterField(
            model_name='request',
            name='expenses',
            field=models.ManyToManyField(blank=True, null=True, to='api.Expenses', verbose_name='Статьи расходов'),
        ),
        migrations.AlterField(
            model_name='request',
            name='rewards',
            field=models.ManyToManyField(blank=True, null=True, to='api.Reward'),
        ),
        migrations.AlterField(
            model_name='request',
            name='stages',
            field=models.ManyToManyField(blank=True, null=True, to='api.Stage', verbose_name='Этапы'),
        ),
        migrations.CreateModel(
            name='MessagesInChat',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('chat', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.chat', verbose_name='чат')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='собеседник')),
            ],
        ),
        migrations.CreateModel(
            name='Messages',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(verbose_name='текст сообщения')),
                ('time', models.DateTimeField(auto_now=True, verbose_name='время сообщения')),
                ('chat', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='api.messagesinchat', verbose_name='чат')),
            ],
        ),
        migrations.AddField(
            model_name='chat',
            name='chats',
            field=models.ManyToManyField(related_name='chats', through='api.MessagesInChat', to=settings.AUTH_USER_MODEL, verbose_name='Собеседники'),
        ),
        migrations.AddField(
            model_name='chat',
            name='user',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL, verbose_name='Пользователь'),
        ),
    ]

# Generated by Django 3.1.3 on 2020-11-28 06:08

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0012_merge_20201128_0603'),
    ]

    operations = [
        migrations.CreateModel(
            name='Chat',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
        ),
        migrations.AlterModelOptions(
            name='request',
            options={},
        ),
        migrations.AlterField(
            model_name='request',
            name='authors',
            field=models.ManyToManyField(blank=True, null=True, to=settings.AUTH_USER_MODEL, verbose_name='Авторы'),
        ),
        migrations.AlterField(
            model_name='request',
            name='digital_categories',
            field=models.ManyToManyField(blank=True, null=True, to='api.DigitalCategory', verbose_name='Цифровые Категории'),
        ),
        migrations.AlterField(
            model_name='request',
            name='expenses',
            field=models.ManyToManyField(blank=True, null=True, to='api.Expenses', verbose_name='Статьи расходов'),
        ),
        migrations.AlterField(
            model_name='request',
            name='rewards',
            field=models.ManyToManyField(blank=True, null=True, to='api.Reward'),
        ),
        migrations.AlterField(
            model_name='request',
            name='stages',
            field=models.ManyToManyField(blank=True, null=True, to='api.Stage', verbose_name='Этапы'),
        ),
        migrations.CreateModel(
            name='MessagesInChat',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('chat', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.chat', verbose_name='чат')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='собеседник')),
            ],
        ),
        migrations.CreateModel(
            name='Messages',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(verbose_name='текст сообщения')),
                ('time', models.DateTimeField(auto_now=True, verbose_name='время сообщения')),
                ('chat', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='api.messagesinchat', verbose_name='чат')),
            ],
        ),
        migrations.AddField(
            model_name='chat',
            name='chats',
            field=models.ManyToManyField(related_name='chats', through='api.MessagesInChat', to=settings.AUTH_USER_MODEL, verbose_name='Собеседники'),
        ),
        migrations.AddField(
            model_name='chat',
            name='user',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL, verbose_name='Пользователь'),
        ),
    ]

# Generated by Django 3.1.3 on 2020-11-28 06:08