Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing acquireConnectionTimeout config option to database #929

Merged
merged 2 commits into from
Jun 14, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,25 @@ The `./config/database.js` accepts 2 main configuration objects:

### `connection` configuration object

| Parameter | Description | Type |
| ------------------------------------------------------------------ | ---------------------------------------------------------------------------- | --------- |
| `client` | Database client to create the connection. `sqlite` or `postgres` or `mysql`. | `String` |
| `connection` | Database [connection information](#connection-parameters) | `Object` |
| `debug` | Show database exchanges and errors. | `Boolean` |
| `useNullAsDefault`<br/><br />_Optional, only for SQLite_ | Use `NULL` as a default value | `Boolean` |
| `pool`<br /><br />_Optional_ | [Database pooling options](#database-pooling-options) | `Object` |
| Parameter | Description | Type | Default |
|----------------------------------------------------------|---------------------------------------------------------------------------------------------|-----------|---------|
| `client` | Database client to create the connection. `sqlite` or `postgres` or `mysql`. | `String` | - |
| `connection` | Database [connection information](#connection-parameters) | `Object` | - |
| `debug` | Show database exchanges and errors. | `Boolean` | `false` |
| `useNullAsDefault`<br/><br />_Optional, only for SQLite_ | Use `NULL` as a default value | `Boolean` | `true` |
| `pool`<br /><br />_Optional_ | [Database pooling options](#database-pooling-options) | `Object` | - |
| `acquireConnectionTimeout`<br /><br />_Optional_ | How long knex will wait before throwing a timeout error when acquiring a connection (in milliseconds) | `Integer` | `60000` |

#### Connection parameters

The `connection.connection` object found in `./config/database.js` is used to pass database connection information and accepts the following parameters:

| Parameter | Description | Type |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------- | --------------------- |
|------------|-------------------------------------------------------------------------------------------------------------------------------|-----------------------|
| `host` | Database host name. Default value: `localhost`. | `String` |
| `port` | Database port | `Integer` |
| `database` | Database name. | `String` |
| `user` | Username used to establish the connection | `String` |
| `user` | Username used to establish the connection | `String` |
| `password` | Password used to establish the connection | `String` |
| `timezone` | Set the default behavior for local time. Default value: `utc` [Timezone options](https://www.php.net/manual/en/timezones.php) | `String` |
| `schema` | Set the default database schema. **Used only for Postgres DB.** | `String` |
Expand All @@ -48,24 +49,24 @@ The `connection.connection` object found in `./config/database.js` is used to pa

The `connection.pool` object optionally found in `./config/database.js` is used to pass [Tarn.js](https://github.com/vincit/tarn.js) database pooling options and accepts the following parameters:

| Parameter | Description | Type | Default |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------- |
| `min` | Minimum number of database connections to keepalive | `Integer` | `0` |
| `max` | Maximum number of database connections to keepalive | `Integer` | `10` |
| `acquireTimeoutMillis` | Time in ms before timing out a database connection attempt | `Integer` | - |
| `createTimeoutMillis` | Time in ms before timing out a create query attempt | `Integer` | - |
| `destroyTimeoutMillis` | Time in ms before timing out a destroy query attempt | `Integer` | - |
| `idleTimeoutMillis` | Time in ms before free database connections are destroyed | `Integer` | - |
| `reapIntervalMillis` | Time in ms to check for idle database connections to destroy | `Integer` | - |
| `createRetryIntervalMillis` | Time in ms to idle before retrying failed create actions | `Integer` | - |
| Parameter | Description | Type | Default |
|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|---------|
| `min` | Minimum number of database connections to keepalive | `Integer` | `0` |
| `max` | Maximum number of database connections to keepalive | `Integer` | `10` |
| `acquireTimeoutMillis` | Time in milliseconds before timing out a database connection attempt | `Integer` | - |
| `createTimeoutMillis` | Time in milliseconds before timing out a create query attempt | `Integer` | - |
| `destroyTimeoutMillis` | Time in milliseconds before timing out a destroy query attempt | `Integer` | - |
| `idleTimeoutMillis` | Time in milliseconds before free database connections are destroyed | `Integer` | - |
| `reapIntervalMillis` | Time in milliseconds to check for idle database connections to destroy | `Integer` | - |
| `createRetryIntervalMillis` | Time in milliseconds to idle before retrying failed create actions | `Integer` | - |
| `afterCreate` | Callback function to execute custom logic when the pool acquires a new connection.<br/><br/>See the [Knex.js documentation](https://knexjs.org/#Installation-pooling) for more information | `Function` | - |

### `settings` configuration object

The `settings` object found in `./config/database.js` is used to configure Strapi-specific database settings and accepts the following parameter:

| Parameter | Description | Type | Default |
| ---------------- | ------------------------------------------------ | --------- | ------- |
|------------------|--------------------------------------------------|-----------|---------|
| `forceMigration` | Enable or disable the forced database migration. | `Boolean` | `true` |

<!-- TODO: Open and track a feature request for autoMigration as it doesn't exist in v4 -->
Expand Down