mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Set connected apps as enabled if any
Could have easily done this manually, but this makes the transition smoother. BTW I tested each case manually, didn't seem worth writing a spec.
This commit is contained in:
committed by
Rachel Arnould
parent
5d732d80a6
commit
bd48a982fb
@@ -0,0 +1,14 @@
|
||||
class SetConnectedAppsEnabledIfAny < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
enabled = []
|
||||
enabled << "discover_regen" if ConnectedApp.discover_regen.any?
|
||||
enabled << "affiliate_sales_data" if ConnectedApp.affiliate_sales_data.any?
|
||||
|
||||
Spree::Config.connected_apps_enabled = enabled.presence&.join(",")
|
||||
end
|
||||
end
|
||||
|
||||
class ConnectedApp < ApplicationRecord
|
||||
scope :discover_regen, -> { where(type: "ConnectedApp") }
|
||||
scope :affiliate_sales_data, -> { where(type: "ConnectedApps::AffiliateSalesData") }
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2024_07_31_065321) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2024_08_01_034710) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "plpgsql"
|
||||
|
||||
Reference in New Issue
Block a user