Commit bde33eec authored by Shinya Maeda's avatar Shinya Maeda

Fix the environment filter of Deployments Finder

Currently, the environment filter infers that the assocaited
environments can be multiple, but it's not the case.
This commit fixes the query to convince PostgreSQL that
the environment is always one.
parent f4e8401b
......@@ -33,7 +33,8 @@ class Deployment < ApplicationRecord
scope :for_environment, -> (environment) { where(environment_id: environment) }
scope :for_environment_name, -> (project, name) do
where(environment_id: Environment.select(:id).where(project: project, name: name))
where('deployments.environment_id = (?)',
Environment.select(:id).where(project: project, name: name).limit(1))
end
scope :for_status, -> (status) { where(status: status) }
......
---
title: Fix environment filter of Deployments Finder
merge_request: 61564
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment