2021-03-30 06:09:22 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-10-06 00:21:49 +08:00
|
|
|
class CopyThrottlingSettingsToNewNames < ActiveRecord::Migration[5.2]
|
|
|
|
tag :predeploy
|
|
|
|
|
|
|
|
def copy_list(source, destination)
|
|
|
|
value = Setting.get(source, nil)
|
|
|
|
Setting.set(destination, value) if value
|
|
|
|
end
|
|
|
|
|
|
|
|
def up
|
|
|
|
return unless Shard.current.default?
|
|
|
|
|
|
|
|
copy_list("request_throttle.whitelist", "request_throttle.approvelist")
|
|
|
|
copy_list("request_throttle.blacklist", "request_throttle.blocklist")
|
|
|
|
end
|
|
|
|
end
|