-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add edition_id
to link check reports
#9986
Open
ChrisBAshton
wants to merge
4
commits into
main
Choose a base branch
from
link-checker-report-edition-ids
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+41
−11
Conversation
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
ChrisBAshton
added a commit
that referenced
this pull request
Feb 26, 2025
Following on from #9986 which introduces the 'edition_id' field, we no longer need the old polymorphic fields.
f8e8858
to
6cf63dc
Compare
edition_id
to link checker reports
edition_id
to link checker reportsedition_id
to link check reports
ChrisBAshton
added a commit
that referenced
this pull request
Feb 26, 2025
Following on from #9986 which introduces the 'edition_id' field, we no longer need the old polymorphic fields.
544636f
to
3abd162
Compare
ryanb-gds
approved these changes
Feb 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to simplify this a bit. We might need to have a chat to the platform team about how best to run long running migrations like this though
The polymorphic association was added in November 2017 with no explanation: 03c4734 Since then, there doesn't seem to have been a single link check report which is associated with anything other than an Edition: ``` $ LinkCheckerApiReport.distinct.pluck(:link_reportable_type) => ["Edition"] ``` Therefore let's remove the obtuse reference and make it clear that a link check report is associated with an edition (not a 'linkable'). This should also cut down on quite a lot of DB space, since we're currently storing the word "Edition" on every single link check report (almost 12 million rows in the DB). We'll deploy this to get the 'edition_id' in place, and start setting it for new link check reports. In a subsequent PR we'll add a data migration to copy over all 'link_reportable' IDs to the new edition_id association, and then delete the obtuse polymorphic reference. Trello: https://trello.com/c/tmnht4P1
3abd162
to
31e9ebd
Compare
In the next PR, we'll switch over to using this property and we'll delete the `link_check_reports` property. We see no value in retaining multiple link check reports per edition. For now, we'll proceed with populating both `link_check_report` and `link_check_reports`.
This will be run manually after the PR is merged.
d4656ea
to
5d98840
Compare
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds
edition_id
association to Link Checker Reports. We'll run the migration and then remove the oldlink_reportable_type
/link_reportable_id
fields which are an unnecessary layer of abstraction.The polymorphic association was added in November 2017 with no explanation: 03c4734
Since then, there doesn't seem to have been a single link check report which is associated with anything other than an Edition:
Therefore let's remove the obtuse reference and make it clear
that a link check report is associated with an edition (not a
'linkable'). This should also cut down on quite a lot of DB space,
since we're currently storing the word "Edition" on every single
link check report (almost 12 million rows in the DB).
Loosely related to https://trello.com/c/tmnht4P1/
Follow these steps if you are doing a Rails upgrade.