[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/orm](../../README) / [index](../README) / TransactionContext

# Variable: TransactionContext

> `const` **TransactionContext**: `AsyncLocalStorage`\<[`SQLInstance`](../interfaces/SQLInstance)\>

Defined in: [packages/orm/src/db/TransactionContext.ts:13](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/db/TransactionContext.ts#L13)

AsyncLocalStorage that carries the active transaction connection through
the call stack. Set by DB.transaction(); read by BaseModel and DB helpers.

This is the correct propagation mechanism for transactions that originate
outside a request context (console commands, scheduled jobs, seeders).
For request-scoped transactions, ctx._transaction is also set for legacy
callers, but TransactionContext is the authoritative source.
