From 70aa8dcde276cdc1b921475849899f0f7f94fcfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E8=BE=B0=E5=8B=87?= Date: Tue, 21 Jul 2026 20:27:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(alembic):=20=E5=90=88=E5=B9=B6=2088f2380=20?= =?UTF-8?q?=E5=BC=95=E5=85=A5=E7=9A=84=E5=8F=8C=20head,=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=20upgrade=20head=20=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 88f2380 把 origin/main 合进本分支后,两条迁移线在 git 上汇合了、在 alembic 图上 却没有:本分支的 ad_reward_boost_round_id → drop_signin_boost_record 与 main 的 merge_active_phone 同从 comparison_llm_cost 分叉,此后再无迁移 revise drop_signin_boost_record,它成了悬空的第二个 head。 后果:`alembic upgrade head`(单数)报 "Multiple head revisions are present"。 按 CLAUDE.md,run.sh 启动即自动迁移 —— app server 直接起不来,CI/线上同样报错。 用标准 merge revision 收敛(而非改 down_revision 指向),保留两侧作者文件不动。 纯 merge,无表结构/数据改动。 验证:alembic heads 恰好一个 merge_signin_boost_main;空库 alembic upgrade head 全链路跑通,current 停在 (head) (mergepoint);ruff 通过;pytest 435 passed (6 个既有失败,与本次改动前一致)。 Co-Authored-By: Claude Opus 4.8 (1M context) --- alembic/versions/merge_signin_boost_main.py | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 alembic/versions/merge_signin_boost_main.py diff --git a/alembic/versions/merge_signin_boost_main.py b/alembic/versions/merge_signin_boost_main.py new file mode 100644 index 0000000..8838a4e --- /dev/null +++ b/alembic/versions/merge_signin_boost_main.py @@ -0,0 +1,32 @@ +"""合并两个 alembic head:drop_signin_boost_record(本分支)+ merge_active_phone(main)。 + +两条线同从 comparison_llm_cost 分叉——本分支的 ad_reward_boost_round_id → drop_signin_boost_record +走「金币膨胀本轮累计 + 下线签到膨胀」;main 侧的 phone_rebind_log / analytics_active_idx 两支已由 +merge_active_phone 收敛。88f2380 把 main 合进本分支后,两条迁移线在 git 上汇合了、在 alembic 图上 +却没有,于是 `alembic upgrade head`(单数)报 "Multiple head revisions are present"——按 CLAUDE.md +run.sh 启动即自动迁移,app server 会直接起不来。 + +本迁移仅把二者收敛成单 head;**不含任何表结构 / 数据改动**(纯 merge)。 + +Revision ID: merge_signin_boost_main +Revises: drop_signin_boost_record, merge_active_phone +Create Date: 2026-07-21 00:00:00.000000 +""" + +from collections.abc import Sequence + +revision: str = "merge_signin_boost_main" +down_revision: str | Sequence[str] | None = ( + "drop_signin_boost_record", + "merge_active_phone", +) +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + """纯合并 head,无 schema 改动。""" + + +def downgrade() -> None: + """拆回两个 head,无 schema 改动。"""