feat: sla 1 - refactor sla_policies model and add applied_sla model (#8602)
* feat: add models * chore: refactor sla column names * chore: remove foreign keys * chore: fix spec * chore: refactor models
This commit is contained in:
8
db/migrate/20231223033019_refactor_sla_policy_columns.rb
Normal file
8
db/migrate/20231223033019_refactor_sla_policy_columns.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class RefactorSlaPolicyColumns < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
rename_column :sla_policies, :rt_threshold, :next_response_time_threshold
|
||||
rename_column :sla_policies, :frt_threshold, :first_response_time_threshold
|
||||
add_column :sla_policies, :description, :string
|
||||
add_column :sla_policies, :resolution_time_threshold, :float
|
||||
end
|
||||
end
|
||||
13
db/migrate/20231223040257_create_applied_slas.rb
Normal file
13
db/migrate/20231223040257_create_applied_slas.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateAppliedSlas < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :applied_slas do |t|
|
||||
t.references :account, null: false
|
||||
t.references :sla_policy, null: false
|
||||
t.references :conversation, null: false
|
||||
|
||||
t.string :sla_status
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
20
db/schema.rb
20
db/schema.rb
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_12_19_073832) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_12_23_040257) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "pg_trgm"
|
||||
@@ -115,6 +115,18 @@ ActiveRecord::Schema[7.0].define(version: 2023_12_19_073832) do
|
||||
t.index ["account_id"], name: "index_agent_bots_on_account_id"
|
||||
end
|
||||
|
||||
create_table "applied_slas", force: :cascade do |t|
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "sla_policy_id", null: false
|
||||
t.bigint "conversation_id", null: false
|
||||
t.string "sla_status"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_applied_slas_on_account_id"
|
||||
t.index ["conversation_id"], name: "index_applied_slas_on_conversation_id"
|
||||
t.index ["sla_policy_id"], name: "index_applied_slas_on_sla_policy_id"
|
||||
end
|
||||
|
||||
create_table "articles", force: :cascade do |t|
|
||||
t.integer "account_id", null: false
|
||||
t.integer "portal_id", null: false
|
||||
@@ -824,12 +836,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_12_19_073832) do
|
||||
|
||||
create_table "sla_policies", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.float "frt_threshold"
|
||||
t.float "rt_threshold"
|
||||
t.float "first_response_time_threshold"
|
||||
t.float "next_response_time_threshold"
|
||||
t.boolean "only_during_business_hours", default: false
|
||||
t.bigint "account_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "description"
|
||||
t.float "resolution_time_threshold"
|
||||
t.index ["account_id"], name: "index_sla_policies_on_account_id"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user