Skip to content

Commit

Permalink
DEV: Fix migration that renamed site settings (#202)
Browse files Browse the repository at this point in the history
There was a typo here - #196 - that unfortunately went through.
  • Loading branch information
nattsw authored Aug 7, 2024
1 parent 83785d9 commit 55970d4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
18 changes: 9 additions & 9 deletions db/migrate/20240715021442_rename_topic_voting_site_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

class RenameTopicVotingSiteSettings < ActiveRecord::Migration[7.0]
def up
execute "UPDATE site_settings SET name = 'topic_voting_alert_votes_left' WHERE name = 'voting_alert_votes_left_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_enabled' WHERE name = 'voting_enabled_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_show_who_voted' WHERE name = 'voting_show_who_voted_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_show_votes_on_profile' WHERE name = 'voting_show_votes_on_profile_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_tl0_vote_limit' WHERE name = 'voting_tl0_vote_limit_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_tl1_vote_limit' WHERE name = 'voting_tl1_vote_limit_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_tl2_vote_limit' WHERE name = 'voting_tl2_vote_limit_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_tl3_vote_limit' WHERE name = 'voting_tl3_vote_limit_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_tl4_vote_limit' WHERE name = 'voting_tl4_vote_limit_flags_after'"
execute "UPDATE site_settings SET name = 'topic_voting_alert_votes_left' WHERE name = 'voting_alert_votes_left'"
execute "UPDATE site_settings SET name = 'topic_voting_enabled' WHERE name = 'voting_enabled'"
execute "UPDATE site_settings SET name = 'topic_voting_show_who_voted' WHERE name = 'voting_show_who_voted'"
execute "UPDATE site_settings SET name = 'topic_voting_show_votes_on_profile' WHERE name = 'voting_show_votes_on_profile'"
execute "UPDATE site_settings SET name = 'topic_voting_tl0_vote_limit' WHERE name = 'voting_tl0_vote_limit'"
execute "UPDATE site_settings SET name = 'topic_voting_tl1_vote_limit' WHERE name = 'voting_tl1_vote_limit'"
execute "UPDATE site_settings SET name = 'topic_voting_tl2_vote_limit' WHERE name = 'voting_tl2_vote_limit'"
execute "UPDATE site_settings SET name = 'topic_voting_tl3_vote_limit' WHERE name = 'voting_tl3_vote_limit'"
execute "UPDATE site_settings SET name = 'topic_voting_tl4_vote_limit' WHERE name = 'voting_tl4_vote_limit'"
end

def down
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

class RenameIncorrectTopicVotingSiteSettings < ActiveRecord::Migration[7.0]
def up
execute "UPDATE site_settings SET name = 'topic_voting_alert_votes_left' WHERE name = 'voting_alert_votes_left'"
execute "UPDATE site_settings SET name = 'topic_voting_enabled' WHERE name = 'voting_enabled'"
execute "UPDATE site_settings SET name = 'topic_voting_show_who_voted' WHERE name = 'voting_show_who_voted'"
execute "UPDATE site_settings SET name = 'topic_voting_show_votes_on_profile' WHERE name = 'voting_show_votes_on_profile'"
execute "UPDATE site_settings SET name = 'topic_voting_tl0_vote_limit' WHERE name = 'voting_tl0_vote_limit'"
execute "UPDATE site_settings SET name = 'topic_voting_tl1_vote_limit' WHERE name = 'voting_tl1_vote_limit'"
execute "UPDATE site_settings SET name = 'topic_voting_tl2_vote_limit' WHERE name = 'voting_tl2_vote_limit'"
execute "UPDATE site_settings SET name = 'topic_voting_tl3_vote_limit' WHERE name = 'voting_tl3_vote_limit'"
execute "UPDATE site_settings SET name = 'topic_voting_tl4_vote_limit' WHERE name = 'voting_tl4_vote_limit'"
end

def down
raise ActiveRecord::IrreversibleMigration
end
end

0 comments on commit 55970d4

Please sign in to comment.