• Dylan Griffith's avatar
    Use _subscriptions join table to count upstream/downstream projects · 239dd6a1
    Dylan Griffith authored
    Prior to this change we were joining through `upstream_subscriptions`
    and `downstream_subscriptions` relations to count `upstream_projects`
    and `downstream_projects`. This uses the `ci_subscriptions_projects`
    table. Since we've added `disable_joins` to these
    `has_many ... through: ...` relations these queries will now be less
    efficient. So instead we've simplified the query to not join at all as
    the `ci_subscriptions_projects.upstream_project_id` and
    `ci_subscriptions_projects.downstream_project_id` are already both
    `NOT NULL` foreign keys which means we already know for sure that
    counting the `ci_subscriptions_projects` rows is equivalent to counting
    the `projects` rows.
    239dd6a1
_index.html.haml 1.22 KB