feat: 将成长档案调整为近期实修回顾

This commit is contained in:
2026-08-03 12:25:51 +08:00
parent d2e08ab36c
commit 7747334ea4
29 changed files with 566 additions and 344 deletions

View File

@@ -174,7 +174,7 @@ def _seed_default_plans() -> None:
{
"name": "五个月深度陪伴版",
"plan_type": "deep",
"description": "支持长期成长档案、阶段报告和更高主题会话额度。",
"description": "支持近期实修回顾、周期实修回顾和更高主题会话额度。",
"validity_days": 150,
"monthly_topic_limit": 90,
"enable_growth_profile": 1,

View File

@@ -0,0 +1,70 @@
"""replace long-term growth profiling with recent practice review
Revision ID: 0025_recent_practice_review
Revises: 0024_topic_settlement_jobs
"""
from __future__ import annotations
from alembic import op
import sqlalchemy as sa
revision = "0025_recent_practice_review"
down_revision = "0024_topic_settlement_jobs"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column(
"sys_topic_summary",
sa.Column("schema_version", sa.Integer(), nullable=False, server_default="1"),
)
op.alter_column("sys_topic_summary", "schema_version", server_default="2")
op.add_column(
"sys_user_growth_profile",
sa.Column("schema_version", sa.Integer(), nullable=False, server_default="1"),
)
op.add_column("sys_user_growth_profile", sa.Column("recent_review", sa.Text(), nullable=True))
op.add_column("sys_user_growth_profile", sa.Column("current_focus", sa.Text(), nullable=True))
op.add_column("sys_user_growth_profile", sa.Column("source_summary_ids", sa.Text(), nullable=True))
op.alter_column("sys_user_growth_profile", "schema_version", server_default="2")
op.add_column(
"sys_periodic_report",
sa.Column("schema_version", sa.Integer(), nullable=False, server_default="1"),
)
op.alter_column("sys_periodic_report", "schema_version", server_default="2")
# 仅替换系统初始深度版的旧说明,避免覆盖管理员已经自定义的文案。
op.execute(
sa.text(
"UPDATE sys_entitlement_plan "
"SET description = :new_description "
"WHERE plan_type = 'deep' AND description = :old_description"
).bindparams(
new_description="支持近期实修回顾、周期实修回顾和更高主题会话额度。",
old_description="支持长期成长档案、阶段报告和更高主题会话额度。",
)
)
def downgrade() -> None:
op.execute(
sa.text(
"UPDATE sys_entitlement_plan "
"SET description = :old_description "
"WHERE plan_type = 'deep' AND description = :new_description"
).bindparams(
old_description="支持长期成长档案、阶段报告和更高主题会话额度。",
new_description="支持近期实修回顾、周期实修回顾和更高主题会话额度。",
)
)
op.drop_column("sys_periodic_report", "schema_version")
op.drop_column("sys_user_growth_profile", "source_summary_ids")
op.drop_column("sys_user_growth_profile", "current_focus")
op.drop_column("sys_user_growth_profile", "recent_review")
op.drop_column("sys_user_growth_profile", "schema_version")
op.drop_column("sys_topic_summary", "schema_version")