Chatwoot/db/migrate/20221116000514_enable_macros_for_all_accounts.rb
Sojan Jose e7f1a9ab4d
chore: Enable Macros for all accounts (#5858)
- migrations to enable macros for all accounts
2022-11-16 00:33:09 +00:00

17 lines
533 B
Ruby

class EnableMacrosForAllAccounts < ActiveRecord::Migration[6.1]
def change
current_config = InstallationConfig.where(name: 'ACCOUNT_LEVEL_FEATURE_DEFAULTS').last
current_config.value.each { |v| v['enabled'] = true if v['name'] == 'macros' }
current_config.save!
ConfigLoader.new.process
Account.find_in_batches do |account_batch|
account_batch.each do |account|
account.enable_features('macros')
account.enable_features('channel_email')
account.save!
end
end
end
end