fix: Index custom attribute uniqueness on account (#3516)

- Move custom attribute uniqueness validation to account
This commit is contained in:
Muhsin Keloth
2021-12-07 18:20:47 +05:30
committed by GitHub
parent 6b025816f5
commit 46afcd9348
3 changed files with 11 additions and 4 deletions

View File

@@ -16,7 +16,7 @@
#
# Indexes
#
# attribute_key_model_index (attribute_key,attribute_model) UNIQUE
# attribute_key_index (attribute_key,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: :attribute_model }
uniqueness: { scope: :account_id }
validates :attribute_display_type, presence: true
validates :attribute_model, presence: true