db-migrate
Advanced tools
Comparing version 1.0.0-beta.14 to 1.0.0-beta.15
@@ -8,4 +8,6 @@ 'use strict'; | ||
const stat = Promise.promisify(fs.stat); | ||
const writeFile = Promise.promisify(fs.writeFile); | ||
const yargs = require('yargs'); | ||
const util = require('util'); | ||
const path = require('path'); | ||
@@ -17,6 +19,24 @@ async function createMigrationDir (dir) { | ||
if (res && res.err === true) { | ||
return mkdirp(dir); | ||
await mkdirp(dir); | ||
} | ||
return Promise.resolve(); | ||
// Create migrations/package.json to ensure migration files are | ||
// executed as CJS and not ESM | ||
// https://github.com/db-migrate/node-db-migrate/issues/721 | ||
const packageJsonPath = path.resolve(dir, 'package.json'); | ||
await stat(packageJsonPath).then( | ||
async () => { | ||
const packageJson = require(packageJsonPath); | ||
packageJson.type = 'commonjs'; | ||
const packageJsonStr = JSON.stringify(packageJson, null, 2); | ||
await writeFile(packageJsonPath, packageJsonStr, 'utf-8'); | ||
}, | ||
async (err) => { | ||
const packageJson = JSON.stringify({ | ||
type: 'commonjs' | ||
}, null, 2) | ||
await writeFile(packageJsonPath, packageJson, 'utf-8'); | ||
} | ||
) | ||
} | ||
@@ -23,0 +43,0 @@ |
@@ -90,2 +90,12 @@ const Promise = require('bluebird'); | ||
if (this.foreign[t]) { | ||
this.modF[n] = this.foreign[n]; | ||
delete this.foreign[t]; | ||
} | ||
if (this.indizies[t]) { | ||
this.modI[n] = this.indizies[t]; | ||
delete this.indizies[t]; | ||
} | ||
this.modC.push({ t: 0, a: 'renameTable', c: [n, t] }); | ||
@@ -92,0 +102,0 @@ |
@@ -34,3 +34,3 @@ { | ||
], | ||
"version": "1.0.0-beta.14", | ||
"version": "1.0.0-beta.15", | ||
"engines": { | ||
@@ -37,0 +37,0 @@ "node": ">=8.0.0" |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
226979
51
4010
35