* Renamed concern from Feature to Featurable * Feature: Installation config (#839) * Added new model installtion config with corresponding migrations and specs * Created an installation config yml (key value store model) * Created a config loader module to load the installaltion configs * Added this to the config loader seeder * Changed the account before create hook for default feature enabling to use the feature values from installtion config * Renamed the feature concern to Featurable to follow the naming pattern for concerns * Added comments and specs for modules and places that deemed necessary * Refactored config loader to reduce cognitive complexity (#839)
This commit is contained in:
13
db/migrate/20200510112339_create_installation_config.rb
Normal file
13
db/migrate/20200510112339_create_installation_config.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateInstallationConfig < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :installation_configs do |t|
|
||||
t.string :name, null: false
|
||||
t.jsonb :serialized_value, null: false, default: '{}'
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :installation_configs, [:name, :created_at], unique: true
|
||||
|
||||
ConfigLoader.new.process
|
||||
end
|
||||
end
|
||||
24
db/schema.rb
24
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: 2020_05_09_044639) do
|
||||
ActiveRecord::Schema.define(version: 2020_05_10_112339) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
@@ -246,6 +246,14 @@ ActiveRecord::Schema.define(version: 2020_05_09_044639) do
|
||||
t.index ["account_id"], name: "index_inboxes_on_account_id"
|
||||
end
|
||||
|
||||
create_table "installation_configs", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.jsonb "serialized_value", default: "{}", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["name", "created_at"], name: "index_installation_configs_on_name_and_created_at", unique: true
|
||||
end
|
||||
|
||||
create_table "messages", id: :serial, force: :cascade do |t|
|
||||
t.text "content"
|
||||
t.integer "account_id", null: false
|
||||
@@ -319,20 +327,6 @@ ActiveRecord::Schema.define(version: 2020_05_09_044639) do
|
||||
t.boolean "payment_source_added", default: false
|
||||
end
|
||||
|
||||
create_table "super_admins", force: :cascade do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.inet "current_sign_in_ip"
|
||||
t.inet "last_sign_in_ip"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["email"], name: "index_super_admins_on_email", unique: true
|
||||
end
|
||||
|
||||
create_table "taggings", id: :serial, force: :cascade do |t|
|
||||
t.integer "tag_id"
|
||||
t.string "taggable_type"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# loading installation configs
|
||||
ConfigLoader.new.process
|
||||
|
||||
account = Account.create!(
|
||||
name: 'Acme Inc',
|
||||
domain: 'support.chatwoot.com',
|
||||
|
||||
Reference in New Issue
Block a user