Drop the legacy notifications table (unused since the Noticed v2 migration in 2024)

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
rails, ruby
领域
database

调研方向

先在 app、lib 和 config 中搜索 notifications,然后阅读 db/schema.rb 中的表定义以及旧的 rake 文件 lib/tasks/deployment/20240604121427_migrate_notifications.rake。添加一个可逆的迁移,删除 notifications 表及其列清单。然后删除该 rake 文件,以及 .standard_todo.yml 中对应的条目(如有)。完成的标准是:bin/rails db:migrate 会更新 db/schema.rb,noticed_events 和 noticed_notifications 保持不变,并且通知相关的 spec 全部通过。

由索引模型根据 Issue 内容生成。

描述

Difficulty: Easy Good First Issue Help Wanted

Problem

The legacy notifications table (Noticed v1) has been unused since the 2024 upgrade to Noticed v2. The after_party task lib/tasks/deployment/20240604121427_migrate_notifications.rake copied its rows into noticed_events / noticed_notifications, and nothing has read or written it since. It still takes ~1.1 MB in production and shows up in db/schema.rb, which confuses people reading the schema (notifications vs noticed_notifications).

What to do

  • Add a migration that drops the table: drop_table :notifications. Strong Migrations is enabled, so give it a full reversible definition (pass the column list from db/schema.rb to drop_table so down can recreate it) and wrap it in safety_assured if Strong Migrations asks.
  • Delete lib/tasks/deployment/20240604121427_migrate_notifications.rake. It's the only code that touches the old table, and it has already run in production: after_party records it in task_records, so removing the file is safe.
  • Remove its entry from .standard_todo.yml if present.
  • Make sure nothing else refers to the old table: grep -rn "notifications" app lib config. User#notifications is class_name: "Noticed::Notification" (the new table), so leave it alone.
  • Run bin/rails db:migrate and commit the updated db/schema.rb. Make sure noticed_events and noticed_notifications are untouched.
  • Run the notification specs: spec/notifications, spec/requests/notifications_spec.rb, spec/lib/tasks/rake_tasks_constants_spec.rb.

Notes

  • Heroku runs migrations automatically in the release phase, so this will apply on the next deploy.
  • If you want to be extra careful, a maintainer can check that production's notifications rows were all migrated before merging (e.g. compare counts with noticed_events created before 2024-06-04), but the table hasn't been written since then either way.

Difficulty: beginner. One migration plus deleting one file.

主要语言
Ruby
星标
383
派生
551
平均合并
2 天 19 小时
30 天内合并 PR
49

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

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

rubyforgood/casa 的其他 Issue

查看 rubyforgood/casa 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

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