Files
server-core/alembic/versions/0075_show_default_question.py
T
Pine 91db9d1a70 feat: 微信分享图独立配置 + 默认问卷开关 + 发布方/管理员权限拆分
- 迁移 0074: events/content_items 加 share_img_timeline(朋友圈1:1)/share_img_message(会话5:4)
- 迁移 0075: events 加 show_default_question(默认问卷「最想解决的问题」admin可控)
- 迁移 0076: events 加 publishers_json(发布方手机号绑定,可编辑活动+审核报名)
- 权限拆分: _can_edit_event(发布方+创建者+运营,不含管理员)/ _can_review_booking(发布方+管理员+创建者+运营)
- 审核报名相关端点改用 _can_review_booking;活动编辑用 _can_edit_event
- event_out 输出 canEdit/canReview/publishers;create/update 接收 publishers
- 我管理的活动包含发布方+管理员命中
2026-09-09 21:52:37 +08:00

33 lines
1.1 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.
"""0075 活动默认问卷开关(events + show_default_question
活动报名时硬编码的「最想解决的问题(选填)」默认问卷,可在 admin 端控制是否显示。
默认 true(兼容旧数据,所有活动默认显示)。
Revision ID: 0075
Revises: 0074
Create Date: 2026-09-09
"""
from alembic import op
import sqlalchemy as sa
revision = "0075"
down_revision = "0074"
branch_labels = None
depends_on = None
def upgrade() -> None:
conn = op.get_bind()
cols = {r[0] for r in conn.execute(sa.text("SHOW COLUMNS FROM `events`"))}
if "show_default_question" not in cols:
op.add_column("events", sa.Column("show_default_question", sa.Boolean, nullable=False,
server_default=sa.text("1"),
comment="报名时是否显示默认问卷「最想解决的问题」"))
def downgrade() -> None:
conn = op.get_bind()
cols = {r[0] for r in conn.execute(sa.text("SHOW COLUMNS FROM `events`"))}
if "show_default_question" in cols:
op.drop_column("events", "show_default_question")