Chore: Migration to enable email channel (#1913)

fixes: #1877
This commit is contained in:
Sojan Jose
2021-03-15 19:15:48 +05:30
committed by GitHub
parent 3fd398879e
commit b6f4006c15
8 changed files with 46 additions and 7 deletions

View File

@@ -0,0 +1,17 @@
class EnableEmailChannel < ActiveRecord::Migration[6.0]
def change
current_config = InstallationConfig.where(name: 'ACCOUNT_LEVEL_FEATURE_DEFAULTS').last
current_config.value.each { |v| v['enabled'] = true if %w[inbound_emails channel_email].include?(v['name']) }
current_config.save!
ConfigLoader.new.process
Account.find_in_batches do |account_batch|
account_batch.each do |account|
account.enable_features('inbound_emails')
account.enable_features('channel_email')
account.save!
end
end
end
end