diff --git a/db/migrate/20240715021442_rename_topic_voting_site_settings.rb b/db/migrate/20240715021442_rename_topic_voting_site_settings.rb index 4b9691b..c9c815f 100644 --- a/db/migrate/20240715021442_rename_topic_voting_site_settings.rb +++ b/db/migrate/20240715021442_rename_topic_voting_site_settings.rb @@ -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 diff --git a/db/migrate/20240807020209_rename_incorrect_topic_voting_site_settings.rb b/db/migrate/20240807020209_rename_incorrect_topic_voting_site_settings.rb new file mode 100644 index 0000000..72529b9 --- /dev/null +++ b/db/migrate/20240807020209_rename_incorrect_topic_voting_site_settings.rb @@ -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