Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add edition_id to link check reports #9986

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ChrisBAshton
Copy link
Contributor

Adds edition_id association to Link Checker Reports. We'll run the migration and then remove the old link_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:

$ 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).

Loosely related to https://trello.com/c/tmnht4P1/


⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

We want data migrations to appear in the order they were defined.
This particular migration was short of one number, which placed
it before `2024121711524600_convert_text_columns_to_utf8mb4.rb`
in the list.
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 and run the migration, before removing the old
fields.
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.
@ChrisBAshton ChrisBAshton force-pushed the link-checker-report-edition-ids branch from 8b1a513 to 422f3f6 Compare February 26, 2025 15:10
@ChrisBAshton ChrisBAshton force-pushed the link-checker-report-edition-ids branch from f8e8858 to 6cf63dc Compare February 26, 2025 15:22
@ChrisBAshton ChrisBAshton changed the title Link checker report edition ids Add edition_id to link checker reports Feb 26, 2025
@ChrisBAshton ChrisBAshton changed the title Add edition_id to link checker reports Add edition_id to link check reports Feb 26, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant