Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBAshton committed Feb 26, 2025
1 parent 422f3f6 commit f8e8858
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable Rails/BulkChangeTable
class RemoveLinkReportableFieldsFromLinkCheckerApiReports < ActiveRecord::Migration[8.0]
def up
# Catch any link reports that have been created since
Expand Down Expand Up @@ -26,3 +27,4 @@ def down
SQL
end
end
# rubocop:enable Rails/BulkChangeTable

0 comments on commit f8e8858

Please sign in to comment.