Files
ai-ticket-platform/backend/apps/audit/migrations/0001_initial.py
2026-06-30 17:46:38 +08:00

62 lines
2.2 KiB
Python

# Generated by Django 5.2.15 on 2026-06-30 07:47
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='OperationAuditLog',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('module', models.CharField(max_length=80)),
('action', models.CharField(max_length=80)),
('target_type', models.CharField(max_length=80)),
('target_id', models.CharField(blank=True, max_length=120)),
('request_snapshot', models.JSONField(blank=True, default=dict)),
('result', models.CharField(max_length=20)),
('ip_address', models.GenericIPAddressField(blank=True, null=True)),
('user_agent', models.TextField(blank=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
(
'user',
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name='operation_audit_logs',
to=settings.AUTH_USER_MODEL,
),
),
],
options={
'ordering': ['-created_at'],
'indexes': [
models.Index(fields=['module', 'action'], name='audit_opera_module_8f87af_idx'),
models.Index(
fields=['target_type', 'target_id'],
name='audit_opera_target__560d76_idx',
),
models.Index(fields=['created_at'], name='audit_opera_created_077b40_idx'),
],
},
),
]