Files

37 lines
1.7 KiB
Python

# Generated by Django 6.0.6 on 2026-06-28 04:14
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='AuditLog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('object_id', models.CharField(db_index=True, max_length=255)),
('action', models.CharField(max_length=20)),
('changes', models.JSONField(blank=True, default=dict)),
('metadata', models.JSONField(blank=True, default=dict)),
('created_at', models.DateTimeField(auto_now_add=True)),
('actor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='audit_logs', to=settings.AUTH_USER_MODEL)),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
],
options={
'db_table': 'audit_logs',
'ordering': ['-created_at'],
'indexes': [models.Index(fields=['content_type', 'object_id', '-created_at', '-id'], name='audit_obj_time_idx'), models.Index(fields=['actor', '-created_at', '-id'], name='audit_actor_time_idx'), models.Index(fields=['action', '-created_at', '-id'], name='audit_action_time_idx')],
},
),
]