DEV: Default num_auto_bump_daily to 0
This commit is contained in:
parent
cda91aa1fe
commit
52a142ac63
@ -645,7 +645,7 @@ class Category < ActiveRecord::Base
|
||||
.joins(:category_setting)
|
||||
.where("category_settings.num_auto_bump_daily > 0")
|
||||
.shuffle
|
||||
.any? { |c| c.auto_bump_topic! }
|
||||
.any?(&:auto_bump_topic!)
|
||||
end
|
||||
|
||||
# will automatically bump a single topic
|
||||
|
||||
@ -26,7 +26,7 @@ end
|
||||
# category_id :bigint not null
|
||||
# require_topic_approval :boolean
|
||||
# require_reply_approval :boolean
|
||||
# num_auto_bump_daily :integer
|
||||
# num_auto_bump_daily :integer default(0)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# auto_bump_cooldown_days :integer default(1)
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ChangeCategorySettingNumAutoBumpDailyDefault < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
change_column_default :category_settings, :num_auto_bump_daily, 0
|
||||
|
||||
execute(<<~SQL)
|
||||
UPDATE category_settings
|
||||
SET num_auto_bump_daily = 0
|
||||
WHERE num_auto_bump_daily IS NULL;
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
change_column_default :category_settings, :num_auto_bump_daily, nil
|
||||
|
||||
execute(<<~SQL)
|
||||
UPDATE category_settings
|
||||
SET num_auto_bump_daily = NULL
|
||||
WHERE num_auto_bump_daily = 0;
|
||||
SQL
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user