summaryrefslogtreecommitdiff
path: root/app/models/milestone.rb
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-04-20 14:00:15 +0000
committerYorick Peterse - OOO until May 4th <yorickpeterse@gmail.com>2018-04-20 14:00:15 +0000
commit9ea2fc85a3387e7bbb10558b3f2302f05abe5b64 (patch)
tree3a56fa83b93423314915c65d6ae549c98d78cacc /app/models/milestone.rb
parent87e592dc0a81d94efac157dfd7382df4e5b2a223 (diff)
downloadgitlab-ce-9ea2fc85a3387e7bbb10558b3f2302f05abe5b64.tar.gz
Atomic internal ids for all models
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r--app/models/milestone.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index a66a0015827..d14e3a4ded5 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -8,7 +8,7 @@ class Milestone < ActiveRecord::Base
Started = MilestoneStruct.new('Started', '#started', -3)
include CacheMarkdownField
- include NonatomicInternalId
+ include AtomicInternalId
include Sortable
include Referable
include StripAttribute
@@ -21,6 +21,9 @@ class Milestone < ActiveRecord::Base
belongs_to :project
belongs_to :group
+ has_internal_id :iid, scope: :project, init: ->(s) { s&.project&.milestones&.maximum(:iid) }
+ has_internal_id :iid, scope: :group, init: ->(s) { s&.group&.milestones&.maximum(:iid) }
+
has_many :issues
has_many :labels, -> { distinct.reorder('labels.title') }, through: :issues
has_many :merge_requests