feat: sla-7 ensure applied_sla uniqueness (#8938)
* feat: refactor fetching sla in action service * chore: modify spec * chore: ensure applied_sla uniqueness * chore: review fixes * feat: add unique index on applied_sla * chore: fix spec * chore: add new specs to improve coverage * chore: improve spec * Update spec/enterprise/services/enterprise/action_service_spec.rb --------- Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
@@ -12,14 +12,17 @@
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_applied_slas_on_account_id (account_id)
|
||||
# index_applied_slas_on_conversation_id (conversation_id)
|
||||
# index_applied_slas_on_sla_policy_id (sla_policy_id)
|
||||
# index_applied_slas_on_account_id (account_id)
|
||||
# index_applied_slas_on_account_sla_policy_conversation (account_id,sla_policy_id,conversation_id) UNIQUE
|
||||
# index_applied_slas_on_conversation_id (conversation_id)
|
||||
# index_applied_slas_on_sla_policy_id (sla_policy_id)
|
||||
#
|
||||
class AppliedSla < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :sla_policy
|
||||
belongs_to :conversation
|
||||
|
||||
validates :account_id, uniqueness: { scope: %i[sla_policy_id conversation_id] }
|
||||
|
||||
enum sla_status: { active: 0, hit: 1, missed: 2 }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user