From ef8417a08d402b8256ae2af384341a14b078d2da Mon Sep 17 00:00:00 2001 From: "weekwith.me" <63915557+0417taehyun@users.noreply.github.com> Date: Tue, 5 Nov 2024 21:13:49 +0900 Subject: [PATCH] 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. --- src/lib/create-config.ts | 5 ++++- website/docs/using-unleash/deploy/configuring-unleash.mdx | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/create-config.ts b/src/lib/create-config.ts index 5e2951c48dd3..e3c386d3d01c 100644 --- a/src/lib/create-config.ts +++ b/src/lib/create-config.ts @@ -259,7 +259,10 @@ const defaultDbOptions: WithOptional = 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', }; diff --git a/website/docs/using-unleash/deploy/configuring-unleash.mdx b/website/docs/using-unleash/deploy/configuring-unleash.mdx index b087d05329aa..aff97d0a6227 100644 --- a/website/docs/using-unleash/deploy/configuring-unleash.mdx +++ b/website/docs/using-unleash/deploy/configuring-unleash.mdx @@ -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