Files
server-core/alembic/versions/0025_comment_reply_like.py
T
Pine 4f11931143 feat(content): 资讯发布时间/来源/发布人规范 + 点赞/留言/分享互动体系
- published_at 发布时间(迁移0022):运营端不限、园区端禁早于3天前,双方均支持定时发布;C端/大屏到点才可见
- 发布人:运营端可设(留空显示官方)、园区端固定园区名只能填来源
- 点赞/分享/留言(迁移0023-0025):content_likes 去重点赞、like_count/share_count、留言回复+评论点赞
- 各出口(内容/留言/入驻资料 docs)统一 resolve_url 生成 CDN 直链;入库统一 to_object_path 对象路径
2026-08-28 17:17:49 +08:00

34 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""留言区微信化:回复(reply_to+ 评论点赞(like_count / comment_likes
Revision ID: 0025_comment_reply_like
Revises: 0024_content_share_count
Create Date: 2026-08-28
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
revision = "0025_comment_reply_like"
down_revision = "0024_content_share_count"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("content_comments", sa.Column("reply_to", sa.String(), nullable=False, server_default=""))
op.add_column("content_comments", sa.Column("like_count", sa.Integer(), nullable=False, server_default="0"))
op.create_table(
"content_comment_likes",
sa.Column("id", sa.String(), primary_key=True),
sa.Column("comment_id", sa.String(), nullable=False, server_default="", index=True),
sa.Column("user_id", sa.String(), nullable=False, server_default="", index=True),
sa.Column("created_at", sa.String(), nullable=False, server_default=""),
)
def downgrade() -> None:
op.drop_table("content_comment_likes")
op.drop_column("content_comments", "like_count")
op.drop_column("content_comments", "reply_to")