# Generated by Django 2.0.3 on 2019-04-11 18:44

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='AuditField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, verbose_name='Field name')),
            ],
        ),
        migrations.CreateModel(
            name='AuditLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ts', models.DateTimeField(editable=False, verbose_name='Timestamp')),
                ('tnum', models.IntegerField(default='-1', editable=False, verbose_name='Transaction number')),
                ('user', models.IntegerField(editable=False, null=True, verbose_name='User ID')),
                ('rid', models.IntegerField(editable=False, verbose_name='Table record ID')),
                ('val', models.CharField(max_length=500, verbose_name='Field value')),
                ('fld', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, to='records_audit.AuditField', verbose_name='Audited field')),
            ],
            options={
                'ordering': ('ts', 'tnum'),
            },
        ),
        migrations.CreateModel(
            name='AuditTable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, verbose_name='Table name')),
            ],
        ),
        migrations.AlterUniqueTogether(
            name='audittable',
            unique_together={('name',)},
        ),
        migrations.AddField(
            model_name='auditlog',
            name='table',
            field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, to='records_audit.AuditTable', verbose_name='Audited table'),
        ),
        migrations.AddField(
            model_name='auditfield',
            name='table',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='records_audit.AuditTable', verbose_name='Audited table'),
        ),
        migrations.AlterUniqueTogether(
            name='auditfield',
            unique_together={('name',)},
        ),
    ]
