Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add preboot context to strong_migrations destructive-operation messages

未关闭 适合新手
#2,963 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
ruby
领域
databases, devops

调研方向

从 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 内容生成。

描述

enhancement

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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codebar/planner 的其他 Issue

查看 codebar/planner 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。