# Generated by Django 3.1.5 on 2021-01-05 21:53

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('sessionlog', '0001_initial'),
        ('account', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='PersistentLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('when', models.DateTimeField(auto_now_add=True, db_index=True, help_text='When change was logged')),
                ('level', models.IntegerField(default=0)),
                ('message', models.TextField(blank=True, default=None, null=True)),
                ('action', models.TextField(blank=True, db_index=True, default=None, max_length=127, null=True)),
                ('component', models.CharField(blank=True, db_index=True, default=None, max_length=127, null=True)),
                ('pkey', models.IntegerField(blank=True, db_index=True, default=None, null=True)),
                ('request_method', models.CharField(blank=True, default=None, max_length=254, null=True)),
                ('tid', models.CharField(blank=True, db_index=True, default=None, max_length=254, null=True)),
                ('request_path', models.TextField(blank=True, default=None, null=True)),
                ('group', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='account.group')),
                ('session', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='sessionlog.sessionlog')),
                ('user', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='AuditLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('when', models.DateTimeField(auto_now_add=True, help_text='When change was logged')),
                ('model', models.CharField(db_index=True, max_length=127)),
                ('pkey', models.IntegerField(db_index=True)),
                ('attribute', models.CharField(max_length=127)),
                ('how', models.TextField(blank=True, max_length=127, null=True)),
                ('referer', models.TextField(blank=True, null=True)),
                ('stack', models.TextField(blank=True, null=True)),
                ('oldval', models.TextField(blank=True, null=True)),
                ('newval', models.TextField(blank=True, null=True)),
                ('session', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='sessionlog.sessionlog')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'permissions': (('can_read', 'Can read audit log'),),
            },
        ),
    ]
