1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

feat: Make disableMigration option handled by environment variable (#8634)

In some cases, people want to disable database migration. For example,
some people or companies want to grant whole permissions to handle the
schema by DBAs, not by application level hence I use
`parseEnvVarBoolean` to handle `disableMigration` option by environment
variable. I set the default value as `false` for the backward
compatibility.
This commit is contained in:
weekwith.me 2024-11-05 21:13:49 +09:00 committed by GitHub
parent b5a2befec7
commit ef8417a08d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -259,7 +259,10 @@ const defaultDbOptions: WithOptional<IDBOption, 'user' | 'password' | 'host'> =
propagateCreateError: false,
},
schema: process.env.DATABASE_SCHEMA || 'public',
disableMigration: false,
disableMigration: parseEnvVarBoolean(
process.env.DATABASE_DISABLE_MIGRATION,
false,
),
applicationName: process.env.DATABASE_APPLICATION_NAME || 'unleash',
};

View File

@ -383,6 +383,7 @@ Unleash options' `db` object.
| `pool.idleTimeoutMillis` | `DATABASE_POOL_IDLE_TIMEOUT_MS` | 30000 | The amount of time (in milliseconds) that a connection must be idle for before it is marked as a candidate for eviction. |
| `applicationName` | `DATABASE_APPLICATION_NAME` | `unleash` | The name of the application that created this Client instance. |
| `schema` | `DATABASE_SCHEMA` | `public` | The schema to use in the database. |
| `disableMigration` | `DATABASE_DISABLE_MIGRATION` | false | The option not to use database migration. |
Alternatively, you can use a
single-host [libpq connection string](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING) to