Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/docs/drivers/sap.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ See [Data Source Options](../data-source/2-data-source-options.md) for the commo
- `encrypt` - Whether to encrypt the connection. For example, `true`.
- `sslValidateCertificate` - Whether to validate the SSL certificate. For example, `true`.
- `key`, `cert` and `ca` - Private key, public certificate and certificate authority for the encrypted connection.
- `driver` - Optional explicit `@sap/hana-client` module instance. If omitted, TypeORM loads `@sap/hana-client` automatically.
- `pool` — Connection pool configuration object:
- `maxConnectedOrPooled` (number) — Max active or idle connections in the pool (default: 10).
- `maxPooledIdleTime` (seconds) — Time before an idle connection is closed (default: 30).
- `maxWaitTimeoutIfPoolExhausted` (milliseconds) - Time to wait for a connection to become available (default: 0, no wait). Requires `@sap/hana-client` version `2.27` or later.
- `pingCheck` (boolean) — Whether to validate connections before use (default: false).
- `poolCapacity` (number) — Maximum number of connections to be kept available (default: no limit).

Removed legacy aliases: `hanaClientDriver`, `pool.max`, `pool.requestTimeout`, `pool.idleTimeout`, `pool.min`, `pool.maxWaitingRequests`, and `pool.checkInterval`.
Comment thread
gioboa marked this conversation as resolved.

See the official documentation of SAP HANA Client for more details as well as the `extra` properties: [Node.js Connection Properties](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/4fe9978ebac44f35b9369ef5a4a26f4c.html).

## Column Types
Expand Down
15 changes: 15 additions & 0 deletions docs/docs/guides/8-migration-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ TypeORM requires newer versions of the database client libraries.

The `connectorPackage` option was removed, together with the support for the old `mysql` client. The only database client supported is now `mysql2`, which TypeORM will try to load by default. If you were using `mysql` in your project, simply replace it with `mysql2`.

## SAP HANA

Several deprecated SAP HANA connection aliases were removed.

- `hanaClientDriver` was removed. Use `driver`.
- `pool.max` was removed. Use `pool.maxConnectedOrPooled`.
- `pool.requestTimeout` was removed. Use `pool.maxWaitTimeoutIfPoolExhausted`.
- `pool.idleTimeout` was removed. Use `pool.maxPooledIdleTime` (seconds).
- `pool.min`, `pool.maxWaitingRequests`, and `pool.checkInterval` were removed with no replacement.

Also note the default behavior changes in pool configuration:

- `pool.maxPooledIdleTime` now defaults to `30` seconds and no longer falls back to `pool.idleTimeout`.
- `pool.maxWaitTimeoutIfPoolExhausted` now defaults to `0` and no longer falls back to `pool.requestTimeout`.

## SQLite

Drop support to `sqlite3` in favour of `better-sqlite3` as the primary driver for `sqlite` databases:
Expand Down
41 changes: 0 additions & 41 deletions src/driver/sap/SapDataSourceOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ export interface SapDataSourceOptions
*/
readonly driver?: any

/**
* @deprecated Use {@link driver} instead.
*/
readonly hanaClientDriver?: any

/**
* Pool options.
*/
Expand Down Expand Up @@ -64,42 +59,6 @@ export interface SapDataSourceOptions
*/
readonly poolCapacity?: number

/**
* Max number of connections.
* @deprecated Use {@link maxConnectedOrPooled} instead.
*/
readonly max?: number

/**
* Minimum number of connections.
* @deprecated Obsolete, no alternative exists.
*/
readonly min?: number

/**
* Maximum number of waiting requests allowed.
* @deprecated Obsolete, no alternative exists.
*/
readonly maxWaitingRequests?: number

/**
* Max milliseconds a request will wait for a resource before timing out.
* @deprecated Use {@link maxWaitTimeoutIfPoolExhausted} instead.
*/
readonly requestTimeout?: number

/**
* How often to run resource timeout checks.
* @deprecated Obsolete, no alternative exists.
*/
readonly checkInterval?: number

/**
* Idle timeout (in milliseconds).
* @deprecated Use {@link maxPooledIdleTime} (in seconds) instead .
*/
readonly idleTimeout?: number

/**
* Function handling errors thrown by drivers pool.
* Defaults to logging error with `warn` level.
Expand Down
13 changes: 3 additions & 10 deletions src/driver/sap/SapDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,11 @@ export class SapDriver implements Driver {
const poolOptions: any = {
maxConnectedOrPooled:
this.options.pool?.maxConnectedOrPooled ??
this.options.pool?.max ??
this.options.poolSize ??
10,
maxPooledIdleTime:
this.options.pool?.maxPooledIdleTime ??
(this.options.pool?.idleTimeout
? this.options.pool.idleTimeout / 1000
: 30),
maxPooledIdleTime: this.options.pool?.maxPooledIdleTime ?? 30,
maxWaitTimeoutIfPoolExhausted:
this.options.pool?.maxWaitTimeoutIfPoolExhausted ??
this.options.pool?.requestTimeout ??
0,
this.options.pool?.maxWaitTimeoutIfPoolExhausted ?? 0,
}
if (this.options.pool?.pingCheck) {
poolOptions.pingCheck = this.options.pool.pingCheck
Expand Down Expand Up @@ -894,7 +887,7 @@ export class SapDriver implements Driver {
* If driver dependency is not given explicitly, then try to load it via "require".
*/
protected loadDependencies(): void {
const client = this.options.driver ?? this.options.hanaClientDriver
const client = this.options.driver
if (client) {
this.client = client

Expand Down
Loading