# Generated by Django 2.2.3 on 2019-08-08 11:53

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import ninagram.cache
import timezone_field.fields


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Chat',
            fields=[
                ('id', models.IntegerField(primary_key=True, serialize=False, unique=True)),
                ('join_date', models.DateTimeField(auto_now=True)),
                ('title', models.CharField(blank=True, max_length=255, null=True)),
                ('username', models.CharField(blank=True, max_length=100, null=True)),
                ('is_staff', models.BooleanField(default=False)),
                ('type', models.CharField(max_length=20)),
                ('timezone', timezone_field.fields.TimeZoneField(null=True)),
                ('lang', models.CharField(default='en', max_length=10)),
            ],
            bases=(models.Model, ninagram.cache.SimpleCache),
        ),
        migrations.CreateModel(
            name='TgUser',
            fields=[
                ('id', models.IntegerField(primary_key=True, serialize=False)),
                ('is_bot', models.BooleanField(default=False)),
                ('chat', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='ninagram.Chat')),
                ('dj', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, related_name='tg', to=settings.AUTH_USER_MODEL)),
            ],
            bases=(models.Model, ninagram.cache.SimpleCache),
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.IntegerField(primary_key=True, serialize=False, unique=True)),
                ('date', models.DateTimeField()),
                ('data', models.TextField(blank=True, null=True)),
                ('forward_date', models.DateTimeField(blank=True, null=True)),
                ('edit_date', models.DateTimeField(blank=True, null=True)),
                ('chat', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='ninagram.Chat')),
                ('forward_from_chat', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='chat_forwarded', to='ninagram.Chat')),
                ('forward_from_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='user_forwarded', to='ninagram.TgUser')),
                ('reply_to', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ninagram.Message')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='ninagram.TgUser')),
            ],
            bases=(models.Model, ninagram.cache.SimpleCache),
        ),
        migrations.CreateModel(
            name='Media',
            fields=[
                ('id', models.CharField(max_length=255, primary_key=True, serialize=False)),
                ('intern', models.FileField(upload_to='ninagram')),
                ('type', models.CharField(max_length=20)),
                ('desc', models.CharField(blank=True, max_length=255, null=True)),
                ('message', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ninagram.Message')),
            ],
            bases=(models.Model, ninagram.cache.SimpleCache),
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('chat', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='ninagram.Chat')),
            ],
            bases=(models.Model, ninagram.cache.SimpleCache),
        ),
        migrations.CreateModel(
            name='Channel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('chat', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='ninagram.Chat')),
            ],
            bases=(models.Model, ninagram.cache.SimpleCache),
        ),
        migrations.CreateModel(
            name='Session',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('state', models.CharField(max_length=100)),
                ('add_infos', models.TextField()),
                ('last_activity', models.DateTimeField(auto_now=True)),
                ('chat', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='ninagram.Chat')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ninagram.TgUser')),
            ],
            options={
                'unique_together': {('user', 'chat')},
            },
            bases=(models.Model, ninagram.cache.SimpleCache),
        ),
    ]
