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

Đang mở Phù hợp với người mới
#7,297 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rails, ruby
Lĩnh vực
database

Hướng nghiên cứu

Bắt đầu bằng cách tìm notifications trong app, lib và config, sau đó đọc định nghĩa bảng trong db/schema.rb và tệp rake cũ lib/tasks/deployment/20240604121427_migrate_notifications.rake. Thêm một migration có thể đảo ngược để xóa notifications cùng danh sách cột của nó. Sau đó xóa tệp rake và mọi mục tương ứng trong .standard_todo.yml. Công việc hoàn tất khi bin/rails db:migrate cập nhật db/schema.rb, noticed_events và noticed_notifications không thay đổi, và các spec liên quan đến thông báo đều vượt qua.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Ruby
Star
382
Fork
547
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rubyforgood/casa

Tất cả issue của rubyforgood/casa

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.