From e7f1a9ab4d006b21fad274fb06f4aa83f1c3e8bd Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Tue, 15 Nov 2022 16:33:09 -0800 Subject: [PATCH] chore: Enable Macros for all accounts (#5858) - migrations to enable macros for all accounts --- config/features.yml | 2 +- ...1116000514_enable_macros_for_all_accounts.rb | 17 +++++++++++++++++ db/schema.rb | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20221116000514_enable_macros_for_all_accounts.rb diff --git a/config/features.yml b/config/features.yml index 322315999..4a0cec325 100644 --- a/config/features.yml +++ b/config/features.yml @@ -18,7 +18,7 @@ - name: agent_bots enabled: false - name: macros - enabled: false + enabled: true - name: agent_management enabled: true - name: team_management diff --git a/db/migrate/20221116000514_enable_macros_for_all_accounts.rb b/db/migrate/20221116000514_enable_macros_for_all_accounts.rb new file mode 100644 index 000000000..76bc1a8b7 --- /dev/null +++ b/db/migrate/20221116000514_enable_macros_for_all_accounts.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index b086ef781..ea56820ba 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"