diff --git a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php --- a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php +++ b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php @@ -1763,6 +1763,16 @@ $viewer = $this->getViewer(); + // If we have an omnipotent viewer and no formal space constraints, don't + // emit a clause. This primarily enables older migrations to run cleanly, + // without fataling because they try to match a `spacePHID` column which + // does not exist yet. See T8743, T8746. + if ($viewer->isOmnipotent()) { + if ($this->spaceIsArchived === null && $this->spacePHIDs === null) { + return null; + } + } + $space_phids = array(); $include_null = false;