36 lines
815 B
Python
36 lines
815 B
Python
"""Remove shared-library and passive Office preview audit noise.
|
|
|
|
Revision ID: 20260716_04
|
|
Revises: 20260716_03
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
|
|
revision = "20260716_04"
|
|
down_revision = "20260716_03"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute("""
|
|
DELETE FROM audit_logs
|
|
WHERE action = 'OFFICE_PREVIEW_OPEN'
|
|
OR lower(entity_type) IN (
|
|
'faq_category',
|
|
'faq_item',
|
|
'faq_reply',
|
|
'faq_replies',
|
|
'precaution',
|
|
'knowledge_note',
|
|
'knowledge_notes',
|
|
'collaboration_file'
|
|
)
|
|
""")
|
|
|
|
|
|
def downgrade() -> None:
|
|
# 被清理的是明确排除出审计范围的共享库和被动预览记录,无法也不应伪造恢复。
|
|
pass
|