Files
twenty/packages/twenty-server/patches
Abdullah. c171c62099 chore(twenty-server): upgrade typeorm to 0.3.29 (#21957)
## Summary

Upgrades **typeorm `0.3.26` → `0.3.29`** and adapts the twenty-orm
`update`/`upsert` overrides to typeorm's newly-added
`options.returning`. Upgrading to resolve
[this](https://github.com/twentyhq/twenty/security/dependabot/1573)
alert.

## Why

`0.3.29` is the latest release compatible with
`@ptc-org/nestjs-query-typeorm` (peers `typeorm@^0.3.15`; the `1.x` line
has no compatible release, so it's blocked until that dependency moves).

## Changes

**`chore` — bump**
- `typeorm` patch descriptor `0.3.26 → 0.3.29` + `yarn.lock`.
- Local patch carried over **unchanged** (pure rename) — both hunks
(`PickKeysByType` nullable-awareness, `DeleteResult.generatedMaps`) are
still absent upstream in `0.3.29`, so it remains load-bearing.

**`refactor` — adapt overrides**
- `0.3.29` adds `options?: UpdateOptions` (carrying `returning`) to
`EntityManager`/`Repository` `update()`. The override must accept it at
the base-mandated position, so it's added as its **own dedicated
parameter** (not hidden inside `permissionOptions`), honoring
`options.returning` with a fallback to Twenty's permission-aware
`selectedColumns` (`'*'` default).
- The same merge is applied to `upsert()`, which already received
`UpsertOptions` but was dropping its `returning` field — so both write
methods now treat the option identically.
- Internal call sites + specs updated for the new parameter slot.

## Verification

- `nx typecheck twenty-server` — **0 errors**
- twenty-orm unit tests — **191 / 191 pass**
- `oxlint` / `oxfmt` — clean
2026-06-22 16:08:09 +02:00
..

How to patch a dependency

yarn patch-commit -s does not work in our monorepo. Use the workflow below instead.

New patch

yarn patch <package-name>
# Yarn prints a temp folder path — edit files there, then:
yarn patch-commit <temp-folder> > packages/twenty-server/patches/<package+name+version>.patch
yarn install --mode update-lockfile && yarn install

Reference the patch in packages/twenty-server/package.json:

"<package-name>": "patch:<package-name>@<version>#./patches/<package+name+version>.patch"

Updating an existing patch

yarn patch -u <package-name>   # extract with current patches applied (PATCHED)
yarn patch <package-name>      # extract clean original (CLEAN)
# Edit files in PATCHED, then copy them into CLEAN
yarn patch-commit <CLEAN> > packages/twenty-server/patches/<package+name+version>.patch
yarn install --mode update-lockfile && yarn install