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

オープン 初心者向け
#7,297 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rails, ruby
領域
database

調査の方向性

app、lib、config で notifications を grep し、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
スター
382
フォーク
547
平均マージ
2日 22時間
マージ済み PR(30日)
46

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rubyforgood/casa のほかの issue

rubyforgood/casa の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。