chore: Add the ability to use same key for conversation and contact (#3526)

This commit is contained in:
Muhsin Keloth
2021-12-08 20:15:27 +05:30
committed by GitHub
parent 35130bc83e
commit 3ee6b7d6e9
3 changed files with 11 additions and 3 deletions

View File

@@ -16,7 +16,7 @@
#
# Indexes
#
# attribute_key_index (attribute_key,account_id) UNIQUE
# attribute_key_model_index (attribute_key,attribute_model,account_id) UNIQUE
# index_custom_attribute_definitions_on_account_id (account_id)
#
class CustomAttributeDefinition < ApplicationRecord
@@ -25,7 +25,7 @@ class CustomAttributeDefinition < ApplicationRecord
validates :attribute_key,
presence: true,
uniqueness: { scope: :account_id }
uniqueness: { scope: [:account_id, :attribute_model] }
validates :attribute_display_type, presence: true
validates :attribute_model, presence: true