2021-07-23 11:34:33 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: custom_attribute_definitions
|
|
|
|
#
|
|
|
|
# id :bigint not null, primary key
|
|
|
|
# attribute_display_name :string
|
|
|
|
# attribute_display_type :integer default("text")
|
2021-08-24 15:47:23 +00:00
|
|
|
# attribute_description :text
|
2021-07-23 11:34:33 +00:00
|
|
|
# attribute_key :string
|
|
|
|
# attribute_model :integer default("conversation_attribute")
|
|
|
|
# default_value :integer
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
# account_id :bigint
|
|
|
|
#
|
|
|
|
# Indexes
|
|
|
|
#
|
|
|
|
# attribute_key_model_index (attribute_key,attribute_model) UNIQUE
|
|
|
|
# index_custom_attribute_definitions_on_account_id (account_id)
|
|
|
|
#
|
|
|
|
class CustomAttributeDefinition < ApplicationRecord
|
|
|
|
validates :attribute_display_name, presence: true
|
|
|
|
|
|
|
|
validates :attribute_key,
|
|
|
|
presence: true,
|
|
|
|
uniqueness: { scope: :attribute_model }
|
|
|
|
|
|
|
|
validates :attribute_display_type, presence: true
|
|
|
|
validates :attribute_model, presence: true
|
|
|
|
|
|
|
|
enum attribute_model: { conversation_attribute: 0, contact_attribute: 1 }
|
2021-08-31 08:24:34 +00:00
|
|
|
enum attribute_display_type: { text: 0, number: 1, currency: 2, percent: 3, link: 4, date: 5 }
|
2021-07-23 11:34:33 +00:00
|
|
|
|
|
|
|
belongs_to :account
|
|
|
|
end
|