-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
422f3f6
commit f8e8858
Showing
2 changed files
with
13 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
db/data_migration/2025022610370000_remove_old_link_checker_reports.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To address https://github.com/alphagov/whitehall/issues/6011, we need | ||
# to remove old link checker reports and switch to a 'has_one' relationship. | ||
|
||
Edition.find_each do |edition| | ||
reports = edition.link_check_reports.order(created_at: :desc).to_a | ||
next if reports.size <= 1 | ||
|
||
# Keep the most recent report and delete the rest | ||
reports_to_delete = reports.drop(1) | ||
reports_to_delete.each(&:destroy) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters