mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 04:59:22 -06:00
21 lines
699 B
Ruby
21 lines
699 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddDurationMinutesToTopicTimer < ActiveRecord::Migration[6.0]
|
|
def up
|
|
add_column :topic_timers, :duration_minutes, :integer
|
|
|
|
# 7 is delete_replies type, this duration is measured in days, the other
|
|
# duration is measured in hours
|
|
DB.exec(
|
|
"UPDATE topic_timers SET duration_minutes = (duration * 60 * 24) WHERE duration_minutes != duration AND status_type = 7 AND duration IS NOT NULL",
|
|
)
|
|
DB.exec(
|
|
"UPDATE topic_timers SET duration_minutes = (duration * 60) WHERE duration_minutes != duration AND status_type != 7 AND duration IS NOT NULL",
|
|
)
|
|
end
|
|
|
|
def down
|
|
remove_column :topic_timers, :duration_minutes
|
|
end
|
|
end
|