diff --git a/CHANGELOG.md b/CHANGELOG.md index c9bafb64bd..d16a0226e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 3.1.6 + +- fix: Database migrator does use the databaseSchema option. + ## 3.1.5 - feat(permission): Implement beta support for permissions. diff --git a/bin/unleash.js b/bin/unleash.js index 5b43a88fe4..8dc5b98b6c 100755 --- a/bin/unleash.js +++ b/bin/unleash.js @@ -27,6 +27,13 @@ const argv = require('yargs') 'The full databaseUrl to connect to, including username and password', demand: true, type: 'string', + }) + .option('databaseSchema', { + alias: 's', + describe: 'The database schema to use', + default: 'public', + demand: false, + type: 'string', }).argv; serverImpl diff --git a/docs/getting-started.md b/docs/getting-started.md index c1344577cd..1ec948ebcf 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -44,6 +44,7 @@ unleash Available unleash options includes: - **databaseUrl** - the postgress database url to connect to. Should include username/password. +- **databaseSchema** - the postgress database schema to use. Defaults to 'public' - **port** - Which port should the unleash-server bind to? - **enableLegacyRoutes** (boolean) - allows you to turn on/off support for legacy routes to support older clients. Enabled by default. - **serverMetrics** (boolean) - Use this option to turn off prometheus metrics. diff --git a/lib/options.js b/lib/options.js index 1fca109425..644869997f 100644 --- a/lib/options.js +++ b/lib/options.js @@ -7,6 +7,7 @@ const THIRTY_DAYS = 30 * 24 * 60 * 60 * 1000; const DEFAULT_OPTIONS = { databaseUrl: process.env.DATABASE_URL, + databaseSchema: 'another', port: process.env.HTTP_PORT || process.env.PORT || 4242, host: process.env.HTTP_HOST, baseUriPath: process.env.BASE_URI_PATH || '', diff --git a/lib/server-impl.js b/lib/server-impl.js index 656d7bb0c8..31351a0391 100644 --- a/lib/server-impl.js +++ b/lib/server-impl.js @@ -49,7 +49,7 @@ async function start(opts) { const options = createOptions(opts); try { - await migrator({ databaseUrl: options.databaseUrl }); + await migrator(options); } catch (err) { logger.error('Failed to migrate db', err); throw err;