Skip to content

Commit

Permalink
Merge 73cba43 into e7c674e
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Jan 31, 2019
2 parents e7c674e + 73cba43 commit 9a7ccb8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion UPGRADING.md
Expand Up @@ -4,7 +4,8 @@

* MSSQL: DB versions older than 2008 are no longer supported, make sure to update your DB;
* PostgreSQL|MySQL: it is recommended to use options object for `table.datetime` and `table.timestamp` methods instead of argument options. See documentation for these methods for more details;
* Node 6: There are known issues with duplicate event listeners when using knex.js with Node 6 (resulting in MaxListenersExceededWarning under certain use-cases (such as reusing single knex instance to run migrations or seeds multiple times)). Please upgrade to Node 8+ as soon as possible (knex 0.17.0 will be dropping Node 6 support altogether).
* Node 6: There are known issues with duplicate event listeners when using knex.js with Node.js 6 (resulting in MaxListenersExceededWarning under certain use-cases (such as reusing single knex instance to run migrations or seeds multiple times)). Please upgrade to Node.js 8+ as soon as possible (knex 0.17.0 will be dropping Node.js 6 support altogether);
* Node 6: Please add '@babel/polyfill' production dependency to the project when using Node.js 6 (it will be loaded by knex automatically).

### Upgrading to version 0.15.0+

Expand Down
16 changes: 11 additions & 5 deletions knex.js
Expand Up @@ -9,13 +9,19 @@ const { isNode6 } = require('./lib/util/version-helper');

// Should be safe to remove after support for Node.js 6 is dropped
if (isNode6()) {
const oldPromise = global.Promise;
try {
const oldPromise = global.Promise;

require('@babel/polyfill');
require('@babel/polyfill');

// Preserve any Promise overrides set globally prior to importing knex
if (oldPromise) {
global.Promise = oldPromise;
// Preserve any Promise overrides set globally prior to importing knex
if (oldPromise) {
global.Promise = oldPromise;
}
} catch (e) {
throw new Error(
`You are using Node.js 6. Please consider upgrading to Node.js 8+ or add '@babel/polyfill' dependency to the project (knex will automatically load it).`
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -8,7 +8,6 @@
"node": ">=6"
},
"dependencies": {
"@babel/polyfill": "^7.2.5",
"@types/bluebird": "^3.5.25",
"bluebird": "^3.5.3",
"colorette": "1.0.7",
Expand All @@ -35,6 +34,7 @@
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.1",
"@types/node": "*",
"JSONStream": "^1.3.5",
Expand Down
3 changes: 2 additions & 1 deletion src/migrate/sources/fs-migrations.js
Expand Up @@ -3,7 +3,8 @@ import path from 'path';
import Promise from 'bluebird';
import { sortBy, filter } from 'lodash';

const readDirAsync = (path) => Promise.promisify(fs.readdir, { context: fs })(path);
const readDirAsync = (path) =>
Promise.promisify(fs.readdir, { context: fs })(path);

export const DEFAULT_LOAD_EXTENSIONS = Object.freeze([
'.co',
Expand Down

0 comments on commit 9a7ccb8

Please sign in to comment.