Fix SQL errors in organization group transfer
What does this MR do?
Fixes two SQL-related errors raised when running Organizations::ActivateService.
-
traversal_idstype mismatch —Organizations::Transfer::TopicsService#old_topicscompared thenamespaces.traversal_idscolumn (bigint[]) against anARRAY[?]::bigint[]literal, which Postgres inferred asinteger[]and rejected:PG::UndefinedFunction: ERROR: operator does not exist: integer[] @> bigint[]Switched to the
'{?}'array-literal form that coerces to the column type, matching every othertraversal_ids @>call site in the codebase. -
Logging against an aborted transaction — once the query above failed, the surrounding transaction was aborted.
Organizations::Transfer::GroupsServiceerror logging then issued DB reads (group.full_path) against the aborted transaction, raising:PG::InFailedSqlTransaction: ERROR: current transaction is abortedLog fields are now captured before the transaction starts, so error logging performs no database reads. The previously commented-out log fields are re-enabled as a result.
Tests
- Added a deeply-nested-group case to
topics_service_spec.rbexercising thetraversal_idsquery. - Existing
groups_service_spec.rberror-logging coverage exercises the re-enabled log fields.