diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-19 06:09:08 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-19 06:09:08 +0000 |
commit | 731d58455c61ad6400924171eb182f2c2ab2f0a4 (patch) | |
tree | d23387995c58b42a09e2d01d11b727696c436a24 /app/models/environment.rb | |
parent | 4e901aff716ec8f8550bde510909277ca2f5a3bd (diff) | |
download | gitlab-ce-731d58455c61ad6400924171eb182f2c2ab2f0a4.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r-- | app/models/environment.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb index ddf2ba9e6c0..66613869915 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -70,6 +70,7 @@ class Environment < ApplicationRecord scope :order_by_last_deployed_at_desc, -> do order(Gitlab::Database.nulls_last_order("(#{max_deployment_id_sql})", 'DESC')) end + scope :order_by_name, -> { order('environments.name ASC') } scope :in_review_folder, -> { where(environment_type: "review") } scope :for_name, -> (name) { where(name: name) } @@ -122,6 +123,10 @@ class Environment < ApplicationRecord pluck(:name) end + def self.pluck_unique_names + pluck('DISTINCT(environments.name)') + end + def self.find_or_create_by_name(name) find_or_create_by(name: name) end |