diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-04-20 14:00:15 +0000 |
---|---|---|
committer | Yorick Peterse - OOO until May 4th <yorickpeterse@gmail.com> | 2018-04-20 14:00:15 +0000 |
commit | 9ea2fc85a3387e7bbb10558b3f2302f05abe5b64 (patch) | |
tree | 3a56fa83b93423314915c65d6ae549c98d78cacc /app/models/milestone.rb | |
parent | 87e592dc0a81d94efac157dfd7382df4e5b2a223 (diff) | |
download | gitlab-ce-9ea2fc85a3387e7bbb10558b3f2302f05abe5b64.tar.gz |
Atomic internal ids for all models
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r-- | app/models/milestone.rb | 5 |
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 |