# This class is to batch-load deployments of multiple environments.
# The deployments to batch-load are fetched using UNION of N selects in a single query instead of default scoping with `IN (environment_id1, environment_id2 ...)`.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/345672#note_761852224 for more details.
# Example query scoped with IN clause for `last_deployment` association preload:
# SELECT DISTINCT ON (environment_id) deployments.* FROM "deployments" WHERE "deployments"."status" IN (1, 2, 3, 4, 6) AND "deployments"."environment_id" IN (35, 34, 33) ORDER BY environment_id, deployments.id DESC
it'avoids scoping with IN clause during preload'do