fix: move beamer backfill to new migration

This commit is contained in:
Daniel Schädler 2026-04-26 23:51:34 +02:00
parent 68b72cc01a
commit 35c8591af3
3 changed files with 20 additions and 7 deletions

View File

@ -14,12 +14,6 @@ class ReplaceBeamerAssetFieldsWithConfig < ActiveRecord::Migration[7.0]
END
SQL
execute <<~SQL.squish
UPDATE beamers
SET config = '{"match_filter":"state:in_progress"}'
WHERE name = 'default'
SQL
change_column_default :beamers, :display_state, from: 'matches_all', to: 'during_game'
remove_column :beamers, :qr_code_url, :string
remove_column :beamers, :logo_url, :string

View File

@ -0,0 +1,19 @@
# frozen_string_literal: true
class BackfillDefaultBeamerConfig < ActiveRecord::Migration[7.0]
def up
execute <<~SQL.squish
UPDATE beamers
SET config = '{"match_filter":"state:in_progress"}'
WHERE name = 'default'
SQL
end
def down
execute <<~SQL.squish
UPDATE beamers
SET config = '{}'
WHERE name = 'default'
SQL
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2026_04_26_120000) do
ActiveRecord::Schema[7.0].define(version: 2026_04_26_121000) do
create_table "beamers", force: :cascade do |t|
t.string "name", null: false
t.string "display_state", default: "during_game", null: false