feat: 静态通知同步 + 积分审计 JSONB 序列化修复
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""add notification static sync fields
|
||||
|
||||
Revision ID: 20260411_0005
|
||||
Revises: 20260411_0004
|
||||
Create Date: 2026-04-11 16:00:00
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision: str = "20260411_0005"
|
||||
down_revision: Union[str, Sequence[str], None] = "20260411_0004"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"notifications",
|
||||
sa.Column(
|
||||
"source",
|
||||
sa.String(length=32),
|
||||
server_default=sa.text("'manual'"),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"notifications",
|
||||
sa.Column("source_key", sa.String(length=128), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"notifications",
|
||||
sa.Column("source_version", sa.Integer(), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"notifications",
|
||||
sa.Column("content_hash", sa.String(length=64), nullable=True),
|
||||
)
|
||||
op.create_index(
|
||||
"uq_notifications_source_source_key",
|
||||
"notifications",
|
||||
["source", "source_key"],
|
||||
unique=True,
|
||||
postgresql_where=sa.text("source_key IS NOT NULL"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index("uq_notifications_source_source_key", table_name="notifications")
|
||||
op.drop_column("notifications", "content_hash")
|
||||
op.drop_column("notifications", "source_version")
|
||||
op.drop_column("notifications", "source_key")
|
||||
op.drop_column("notifications", "source")
|
||||
Reference in New Issue
Block a user