Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
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