# Generated by Django 5.1.1 on 2025-01-08 20:04

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('accrete', '0002_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Log',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('model', models.CharField(help_text='Combination of app label and model name seperated by a dot', max_length=255, verbose_name='Model')),
                ('field', models.CharField(max_length=255, verbose_name='Field')),
                ('object_id', models.BigIntegerField(verbose_name='Object ID')),
                ('log_date', models.DateTimeField(auto_now_add=True, verbose_name='Date')),
                ('old_value_type', models.CharField(choices=[('fk', 'Foreign Key'), ('int', 'Integer'), ('float', 'Float'), ('decimal', 'Decimal'), ('bool', 'Boolean'), ('str', 'String')], max_length=100, verbose_name='Old Value Type')),
                ('new_value_type', models.CharField(choices=[('fk', 'Foreign Key'), ('int', 'Integer'), ('float', 'Float'), ('decimal', 'Decimal'), ('bool', 'Boolean'), ('str', 'String')], max_length=100, verbose_name='New Value Type')),
                ('old_value', models.TextField(blank=True, null=True, verbose_name='Old Value')),
                ('new_value', models.TextField(blank=True, null=True, verbose_name='New Value')),
                ('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accrete.tenant', verbose_name='Tenant')),
            ],
            options={
                'verbose_name': 'Log',
                'verbose_name_plural': 'Logs',
                'db_table': 'accrete_log',
                'indexes': [models.Index(fields=['model', 'object_id'], name='accrete_log_model_cf888c_idx')],
                'constraints': [models.UniqueConstraint(fields=('model', 'field', 'object_id', 'log_date'), name='unique_group_fields')],
            },
        ),
    ]
