summaryrefslogtreecommitdiff
path: root/app/models/work_items/hierarchy_restriction.rb
blob: a253447a8db330c57f4c3a113549fda023182cb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

module WorkItems
  class HierarchyRestriction < ApplicationRecord
    self.table_name = 'work_item_hierarchy_restrictions'

    belongs_to :parent_type, class_name: 'WorkItems::Type'
    belongs_to :child_type, class_name: 'WorkItems::Type'

    validates :parent_type, presence: true
    validates :child_type, presence: true
    validates :child_type, uniqueness: { scope: :parent_type_id }
  end
end