- Fix delete agent 500: clean up FK records (agent_llm_logs, permissions, schedules, executions, team_members) and unbind goals/tasks before delete - Remove hardcoded personality templates in Android, replace with dynamic system prompt generation from name + description - Set promptSectionsEnabled=false to bypass PromptComposer for personality - Add Tencent Cloud Linux deployment guide (Docker Compose) - Accumulated backend service updates, frontend UI fixes, Android app changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
42 lines
1.7 KiB
Python
42 lines
1.7 KiB
Python
"""add audit_logs table
|
|
|
|
Revision ID: 021_add_audit_logs
|
|
Revises: 020_add_feedback_records
|
|
Create Date: 2026-05-10
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = "021_add_audit_logs"
|
|
down_revision = "020_add_feedback_records"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"audit_logs",
|
|
sa.Column("id", sa.String(36), primary_key=True, comment="日志ID"),
|
|
sa.Column("user_id", sa.String(36), nullable=False, index=True, comment="操作用户ID"),
|
|
sa.Column("username", sa.String(100), nullable=False, comment="操作用户名"),
|
|
sa.Column("action", sa.String(50), nullable=False, index=True, comment="操作类型"),
|
|
sa.Column("resource_type", sa.String(100), nullable=False, comment="资源类型"),
|
|
sa.Column("resource_id", sa.String(100), nullable=True, comment="资源ID"),
|
|
sa.Column("resource_name", sa.String(255), nullable=True, comment="资源名称"),
|
|
sa.Column("detail", sa.JSON, nullable=True, comment="操作详情"),
|
|
sa.Column("ip_address", sa.String(45), nullable=True, comment="客户端IP"),
|
|
sa.Column("status", sa.String(20), nullable=False, server_default="success", comment="操作状态"),
|
|
sa.Column("created_at", sa.DateTime, comment="操作时间"),
|
|
)
|
|
op.create_index("ix_audit_user_id", "audit_logs", ["user_id"])
|
|
op.create_index("ix_audit_action", "audit_logs", ["action"])
|
|
op.create_index("ix_audit_created_at", "audit_logs", ["created_at"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_audit_created_at", table_name="audit_logs")
|
|
op.drop_index("ix_audit_action", table_name="audit_logs")
|
|
op.drop_index("ix_audit_user_id", table_name="audit_logs")
|
|
op.drop_table("audit_logs")
|