# Generated by Django 3.0.5 on 2021-10-08 21:05

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=75)),
                ('user_key', models.CharField(db_index=True, max_length=75, unique=True)),
                ('active', models.BooleanField(default=True)),
                ('created_on', models.DateTimeField(auto_now=True, db_index=True)),
                ('updated_on', models.DateTimeField(blank=True, db_index=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Stream',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=75)),
                ('subscription_id', models.CharField(db_index=True, max_length=100, unique=True)),
                ('active', models.BooleanField(default=True)),
                ('created_on', models.DateTimeField(auto_now=True, db_index=True)),
                ('updated_on', models.DateTimeField(blank=True, db_index=True, null=True)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fetch_stream.Account')),
            ],
        ),
        migrations.CreateModel(
            name='StreamMessage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('message_id', models.CharField(max_length=100)),
                ('raw_message_dict', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=None, help_text='contains data received from stream', null=True)),
                ('status', models.IntegerField(choices=[(1, 'PENDING'), (2, 'FETCHED')], db_index=True, default=1)),
                ('action', models.CharField(choices=[('add', 'ADD'), ('rep', 'UPDATE'), ('del', 'DELETE')], db_index=True, default='add', max_length=5)),
                ('created_on', models.DateTimeField(auto_now=True, db_index=True)),
                ('updated_on', models.DateTimeField(blank=True, db_index=True, null=True)),
                ('stream', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fetch_stream.Stream')),
            ],
            options={
                'unique_together': {('message_id', 'action')},
            },
        ),
    ]

# Generated by Django 3.0.5 on 2021-10-08 21:05

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=75)),
                ('user_key', models.CharField(db_index=True, max_length=75, unique=True)),
                ('active', models.BooleanField(default=True)),
                ('created_on', models.DateTimeField(auto_now=True, db_index=True)),
                ('updated_on', models.DateTimeField(blank=True, db_index=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Stream',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=75)),
                ('subscription_id', models.CharField(db_index=True, max_length=100, unique=True)),
                ('active', models.BooleanField(default=True)),
                ('created_on', models.DateTimeField(auto_now=True, db_index=True)),
                ('updated_on', models.DateTimeField(blank=True, db_index=True, null=True)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fetch_stream.Account')),
            ],
        ),
        migrations.CreateModel(
            name='StreamMessage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('message_id', models.CharField(max_length=100)),
                ('raw_message_dict', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=None, help_text='contains data received from stream', null=True)),
                ('status', models.IntegerField(choices=[(1, 'PENDING'), (2, 'FETCHED')], db_index=True, default=1)),
                ('action', models.CharField(choices=[('add', 'ADD'), ('rep', 'UPDATE'), ('del', 'DELETE')], db_index=True, default='add', max_length=5)),
                ('created_on', models.DateTimeField(auto_now=True, db_index=True)),
                ('updated_on', models.DateTimeField(blank=True, db_index=True, null=True)),
                ('stream', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fetch_stream.Stream')),
            ],
            options={
                'unique_together': {('message_id', 'action')},
            },
        ),
    ]

# Generated by Django 3.0.5 on 2021-10-08 21:05