Add preboot context to strong_migrations destructive-operation messages
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 config/initializers/strong_migrations.rb 和 lib/strong_migrations/error_messages.rb 中的 strong_migrations 键列表开始,重点关注 issue 中列出的九个键。阅读 AGENTS.md 中关于 Heroku preboot 的部分,然后使用一次性的 rename_column migration 运行 bundle exec rake db:migrate。完成的标准是出现 preboot 说明,且不更改其他消息文本。
由索引模型根据 Issue 内容生成。
描述
Follow-up from #2949 (preboot enabled on codebar-production).
With preboot, the release phase (rake db:prepare) runs before old web dynos stop, so old code serves against the new schema for ~3 minutes after each deploy. When strong_migrations raises on a destructive operation, its message ends with "wrap this step in a safety_assured block" — which under preboot only means "the old release tolerates this", not "this is safe to deploy right now". That distinction is documented in AGENTS.md ("Migrations and Heroku preboot") but is invisible at the moment a migration author is staring at the error.
Proposal
Append a short preboot note to the destructive-operation messages via StrongMigrations.error_messages (docs; key list in the gem's lib/strong_migrations/error_messages.rb, confirmed for 2.8.0). Relevant keys: change_column, change_column_with_not_null, change_column_default, change_column_null, rename_column, rename_table, rename_schema, rename_enum_value, execute. One possible shape:
# config/initializers/strong_migrations.rb
note = <<~TXT
Heroku preboot: this runs in the release phase before old web dynos stop,
so old code serves against the new schema for ~3 minutes after the deploy.
See AGENTS.md ("Migrations and Heroku preboot"). If the migration cannot
be made forward-compatible, disable preboot for this deploy.
TXT
%i[change_column change_column_with_not_null change_column_default
change_column_null rename_column rename_table rename_schema
rename_enum_value execute].each do |key|
StrongMigrations.error_messages[key] = StrongMigrations.error_messages[key] + "\n\n" + note
end
Verification
Write a throwaway migration containing a flagged operation (e.g. rename_column), run bundle exec rake db:migrate in development, and check the printed message carries the note. Confirm no other message text changed.
Out of scope
Changing any gem defaults beyond messages; touching start_after or target_postgresql_version.
- 主要语言
- Ruby
- 星标
- 104
- 派生
- 205
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 77
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codebar/planner 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 56/100
维护者通常 1 天内回复
-
InvitationManager silently no-ops on non-invitable events/workshops while controllers flash success未关闭bug
难度 3/5 1-2 天 新手友好度 72/100
维护者通常 1 天内回复
-
refactoring tech debt
难度 4/5 3-5 天 新手友好度 72/100
维护者通常 1 天内回复
-
refactoring tech debt
难度 3/5 1-2 天 新手友好度 68/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 3 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
jetrockets/jet_ui#47 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
FreeCAD/homebrew-freecad#870 ·
维护者通常 1 天内回复