chore: Enable Macros for all accounts (#5858)

- migrations to enable macros for all accounts
This commit is contained in:
Sojan Jose 2022-11-15 16:33:09 -08:00 committed by GitHub
parent 826a735cdb
commit e7f1a9ab4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View file

@ -18,7 +18,7 @@
- name: agent_bots
enabled: false
- name: macros
enabled: false
enabled: true
- name: agent_management
enabled: true
- name: team_management

View file

@ -0,0 +1,17 @@
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

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_11_02_082737) do
ActiveRecord::Schema.define(version: 2022_11_16_000514) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"