SIGN IN SIGN UP

Collapse the ORM v1/v2 seams left after the v2 cutover (#24747)

## What

First of three PRs splitting #24745 (kept closed as reference). This one
collapses the seams the v1/v2 split left behind, now that v2 is the only
workspace ORM.

- **`ProcessNestedRelationsHelper` was a pure pass-through** around the
orm-v2 implementation, the old v1/v2 branch point. The real helper takes
over its name and the wrapper is deleted; `useReplica` keeps its `false`
default (the argument becomes optional on the collapsed helper).
- **Delete `WorkspaceDataSourceService.checkSchemaExists`**: zero
callers.
- **Make the v2 datasource `getRepository` generic** (mirroring the ORM
manager) so the common query runner types the repository through the
generic parameter instead of an `as unknown as` cast.
- **Replace the structural `RecordQueryBuilder` /
`ReadRecordQueryBuilder` types with the concrete select query builder.**
They were declared structurally "so both ORM implementations satisfy it
without a cast", and there is one implementation now. This also surfaced
that one call site's `isDefined` came from class-validator (not a type
guard), which the duck type had been masking; the check is now an
explicit undefined comparison.

## Coming next (in sequence, each after the previous merges)

1. Drop the ignored `workspaceId` argument from `getRepository` and
every call site.
2. Merge `twenty-orm-v2/` into `twenty-orm/` and drop the v2 suffixes.

## Verification

- `tsgo --noEmit` clean, `oxlint --type-aware` and `oxfmt` clean on the
15 changed files
- Nested-relations, find-many, query-parser and query-builder unit
suites pass (103 tests)
- All changes are behavior-neutral; `server-integration-test` is the
end-to-end proof


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/24747?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
C
Charles Bochet committed
e6ff527d05e4ee62f4a43b25584505f255f420ae
Parent: 9c8af48
Committed by GitHub <noreply@github.com> on 8/25/2026, 11:49:33 AM