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
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/minitest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ jobs:
env:
RAILS_ENV: test
TEST_DATABASE_URL: ${{ steps.setup-mysql.outputs.db-url }}
run: bundle exec rails db:setup
run: |
bundle exec rails db:setup
bundle exec rails db:migrate
- name: Run Minitest
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class AddEditionIdToLinkCheckerApiReports < ActiveRecord::Migration[8.0]
def up
# Add the new column
add_reference :link_checker_api_reports, :edition, foreign_key: true

# Migrate data from polymorphic association to edition_id
execute <<-SQL.squish
UPDATE link_checker_api_reports
SET edition_id = link_reportable_id
WHERE link_reportable_type = 'Edition'
SQL
end

def down
remove_reference :link_checker_api_reports, :edition, foreign_key: true
end
end
Loading