db-migrator
Advanced tools
Comparing version 2.0.3 to 2.0.4
'use strict' | ||
/* eslint-disable no-console, no-process-exit, no-process-env */ | ||
const migrate = require('db-migrator/lib/migrate') | ||
const status = require('db-migrator/lib/status') | ||
const dotenv = require('dotenv') | ||
const co = require('co') | ||
const path = require('path') | ||
@@ -15,9 +16,5 @@ | ||
case 'staging': | ||
envFile = '.env-heroku-staging' | ||
break | ||
case 'production': | ||
envFile = '.env-heroku-production' | ||
break | ||
case 'dev': | ||
envFile = '.env-heroku-dev' | ||
envFile = `.env-heroku-${env}` | ||
break | ||
@@ -29,7 +26,6 @@ default: | ||
dotenv.config({ | ||
path: path.join(__dirname, envFile) | ||
path: path.join(__dirname, envFile), | ||
}) | ||
const DB_URL = (process.env.PG_URL || process.env.DATABASE_URL) + '?ssl=true' | ||
if (!DB_URL) { | ||
if (!process.env.DATABASE_URL) { | ||
console.error('DB connection string not defined.') | ||
@@ -39,17 +35,20 @@ process.exit(1) | ||
co(function*() { | ||
yield status({ | ||
const DB_URL = `${process.env.DATABASE_URL}?ssl=true` | ||
async function run() { | ||
await status({ | ||
connectionString: DB_URL, | ||
path: './migrations', | ||
tableName: 'migrations' | ||
tableName: 'migrations', | ||
}) | ||
yield migrate({ | ||
await migrate({ | ||
connectionString: DB_URL, | ||
path: './migrations', | ||
tableName: 'migrations' | ||
tableName: 'migrations', | ||
}) | ||
console.log(envFile, 'migrated') | ||
process.exit(0) | ||
}).catch(function () { | ||
process.exit(1) | ||
}) | ||
} | ||
run() | ||
.then(() => process.exit(0)) | ||
.catch(() => process.exit(1)) |
{ | ||
"name": "db-migrator", | ||
"description": "The complete and easy to use database migration tool", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"bin": { | ||
@@ -6,0 +6,0 @@ "db-migrate": "bin/db-migrate", |
@@ -78,3 +78,3 @@ DB Migrator | ||
Check out [this document](docs/CONFIGURATION.md) to find out more. | ||
Check out [this document](doc/CONFIGURATION.md) to find out more. | ||
@@ -81,0 +81,0 @@ ## Common Pitfalls |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
174021
807