Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/work_items/hierarchy_restriction.rb')
-rw-r--r--app/models/work_items/hierarchy_restriction.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/work_items/hierarchy_restriction.rb b/app/models/work_items/hierarchy_restriction.rb
new file mode 100644
index 00000000000..a253447a8db
--- /dev/null
+++ b/app/models/work_items/hierarchy_restriction.rb
@@ -0,0 +1,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