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

DEV: Also rename sequences away from discourse_voting prefix #224

Merged
merged 1 commit into from
Dec 10, 2024
Merged
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
28 changes: 28 additions & 0 deletions db/migrate/20241210081242_rename_sequences.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

class RenameSequences < ActiveRecord::Migration[7.0]
def up
rename_sequence(
"discourse_voting_topic_vote_count_id_seq",
"topic_voting_topic_vote_count_id_seq",
)
rename_sequence("discourse_voting_votes_id_seq", "topic_voting_votes_id_seq")
rename_sequence(
"discourse_voting_category_settings_id_seq",
"topic_voting_category_settings_id_seq",
)
end

def down
raise ActiveRecord::IrreversibleMigration
end

private

def rename_sequence(existing_sequence_name, new_name)
execute <<~SQL
ALTER SEQUENCE #{existing_sequence_name}
RENAME TO #{new_name};
SQL
end
end
Loading