This removes the need for a default scope that adds a "WHERE project_id
= X" clause. This commit also includes an additional index for
Environment#last_deployment, ensuring this query uses just an index scan
instead of also applying a Filter.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36877