discourse/db/migrate/20250902014817_add_timerable_id_to_topic_timer.rb
Alan Guo Xiang Tan a05bb42b85
DEV: Remove unnecessary topic_timers_topic_id_trigger trigger (#34866)
This was causing restores to fail. The trigger is also unnecessary
because the `topic_id` column is already marked as read-only.

Follow-up to eeeb7d302f
2025-09-19 10:14:23 +08:00

18 lines
663 B
Ruby

# frozen_string_literal: true
class AddTimerableIdToTopicTimer < ActiveRecord::Migration[8.0]
def up
add_column :topic_timers, :timerable_id, :integer
add_index :topic_timers,
:timerable_id,
unique: true,
name: :idx_timerable_id_public_type_deleted_at,
where: "public_type = true AND deleted_at IS NULL AND type = 'TopicTimer'"
add_index :topic_timers, :timerable_id, where: "deleted_at IS NULL"
change_column_null :topic_timers, :topic_id, true
Migration::ColumnDropper.mark_readonly(:topic_timers, :topic_id)
end
def down
raise ActiveRecord::IrreversibleMigration
end
end