Files
opc-backend/system/migrations/0001_initial.py

109 lines
4.9 KiB
Python
Raw Normal View History

# Generated by Django 4.2.30 on 2026-04-25 09:46
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Announcement',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('title', models.CharField(max_length=256)),
('content', models.TextField()),
('cover_url', models.CharField(blank=True, max_length=512, null=True)),
('is_published', models.BooleanField(default=False)),
('published_at', models.DateTimeField(blank=True, null=True)),
('is_deleted', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'announcements',
},
),
migrations.CreateModel(
name='AuditLog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('action', models.CharField(max_length=128)),
('resource', models.CharField(blank=True, max_length=128, null=True)),
('resource_id', models.CharField(blank=True, max_length=128, null=True)),
('detail', models.JSONField(default=dict)),
('ip', models.GenericIPAddressField(blank=True, null=True)),
('user_agent', models.TextField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'audit_logs',
},
),
migrations.CreateModel(
name='ModelToken',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('model_id', models.CharField(max_length=128)),
('model_name', models.CharField(blank=True, max_length=256, null=True)),
('token_value', models.TextField()),
('expires_at', models.DateTimeField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'model_tokens',
},
),
migrations.CreateModel(
name='Notification',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('type', models.CharField(choices=[('SYSTEM', '系统通知'), ('CERTIFICATION', '认证通知'), ('TASK', '任务通知'), ('RESERVATION', '预约通知')], max_length=32)),
('title', models.CharField(max_length=256)),
('content', models.TextField()),
('related_id', models.CharField(blank=True, max_length=128, null=True)),
('is_read', models.BooleanField(default=False)),
('is_deleted', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'notifications',
},
),
migrations.CreateModel(
name='SmsVerification',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('phone', models.CharField(max_length=20)),
('scene', models.CharField(choices=[('REGISTER', '注册'), ('LOGIN', '登录'), ('RESET_PASSWORD', '重置密码')], max_length=32)),
('code', models.CharField(max_length=8)),
('is_used', models.BooleanField(default=False)),
('expired_at', models.DateTimeField()),
('used_at', models.DateTimeField(blank=True, null=True)),
('ip', models.GenericIPAddressField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'sms_verifications',
},
),
migrations.CreateModel(
name='SystemConfig',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('config_key', models.CharField(max_length=128, unique=True)),
('config_value', models.JSONField()),
('description', models.TextField(blank=True, null=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'system_configs',
},
),
]