Skip to content

Commit

Permalink
Prepare 0.20.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Oct 25, 2019
1 parent 03ecbee commit 1c65562
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 46 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,36 @@
# Master (Unreleased)

# 0.20.0 - 25 October, 2019

### New features:

- orderBy accepts QueryBuilder #3491
- Add validation in `.offset()` #2908
- disable_migrations_list_validation feature #3448

### Bug fixes:

- Fix oracledb driver v4 support #3480
- Fix some issues around seed and migration generation #3479
- Fix bugs in replacement logic used when dropping columns in SQLite #3476

### Typings:

- Add types to the Migrator interface #3459
- Fix typings of index and dropIndex TableBuilder methods #3486
- Fixes types for Seeder#run #3438

### Test / internal changes:

- Execute CI on Node.js 13
- Bluebird: remove usage of `return`, `reflect`, `fromCallback` methods #3483
- Bluebird: remove Bluebird.bind #3477
- Bluebird: use util.promisify instead of Bluebird.promisify #3470
- Bluebird: remove Bluebird.each #3471
- Bluebird: remove Bluebird.map and Bluebird.mapSeries #3474
- Bluebird: replace Bluebird.map with Promise.all #3469
- Update badges #3482

# 0.19.5 - 06 October, 2019

### New features:
Expand Down
9 changes: 5 additions & 4 deletions lib/migrate/MigrationGenerator.js
Expand Up @@ -29,16 +29,17 @@ class MigrationGenerator {
const dirs = this._absoluteConfigDirs();

const promises = dirs.map((dir) => {
return promisify(fs.stat)(dir)
.catch(() => promisify(mkdirp)(dir));
return promisify(fs.stat)(dir).catch(() => promisify(mkdirp)(dir));
});

return Promise.all(promises);
}

_getStubPath() {
return this.config.stub ||
path.join(__dirname, 'stub', this.config.extension + '.stub');
return (
this.config.stub ||
path.join(__dirname, 'stub', this.config.extension + '.stub')
);
}

_getNewMigrationName(name) {
Expand Down
15 changes: 6 additions & 9 deletions lib/seed/Seeder.js
Expand Up @@ -42,15 +42,12 @@ class Seeder {
async _listAll(config) {
this.config = this.setConfig(config);
const loadExtensions = this.config.loadExtensions;
return promisify(fs.readdir)(
this._absoluteConfigDir()
)
.then((seeds) =>
filter(seeds, (value) => {
const extension = path.extname(value);
return includes(loadExtensions, extension);
}).sort()
);
return promisify(fs.readdir)(this._absoluteConfigDir()).then((seeds) =>
filter(seeds, (value) => {
const extension = path.extname(value);
return includes(loadExtensions, extension);
}).sort()
);
}

// Ensures a folder for the seeds exist, dependent on the
Expand Down
14 changes: 9 additions & 5 deletions lib/util/template.js
Expand Up @@ -32,20 +32,24 @@ const jsFileTemplate = async (filePath, options) => {

/**
* Write a javascript file using another file as a (lodash) template
*
* @param {string} targetFilePath
* @param {string} sourceFilePath
*
* @param {string} targetFilePath
* @param {string} sourceFilePath
* @param {_.TemplateOptions} options options passed to lodash templates
*/
const writeJsFileUsingTemplate = async (
targetFilePath,
sourceFilePath,
options,
variables
) => writeFile(targetFilePath, (await jsFileTemplate(sourceFilePath, options))(variables));
) =>
writeFile(
targetFilePath,
(await jsFileTemplate(sourceFilePath, options))(variables)
);

module.exports = {
jsSourceTemplate,
jsFileTemplate,
writeJsFileUsingTemplate
writeJsFileUsingTemplate,
};
18 changes: 9 additions & 9 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "knex",
"version": "0.19.5",
"version": "0.20.0",
"description": "A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser",
"main": "knex.js",
"types": "types/index.d.ts",
Expand Down Expand Up @@ -28,7 +28,7 @@
"stress:destroy": "docker-compose -f scripts/stress-test/docker-compose.yml stop"
},
"dependencies": {
"bluebird": "^3.7.0",
"bluebird": "^3.7.1",
"colorette": "1.1.0",
"commander": "^3.0.2",
"debug": "4.1.1",
Expand Down Expand Up @@ -56,17 +56,17 @@
"chai": "^4.2.0",
"chai-subset-in-order": "^2.1.3",
"cli-testlab": "^1.8.0",
"coveralls": "^3.0.6",
"coveralls": "^3.0.7",
"cross-env": "^6.0.3",
"dtslint": "^0.9.8",
"dtslint": "^0.9.9",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-import": "^2.18.2",
"husky": "^3.0.8",
"husky": "^3.0.9",
"jake": "^8.1.1",
"lint-staged": "^9.4.1",
"mocha": "^6.2.1",
"mock-fs": "^4.10.1",
"lint-staged": "^9.4.2",
"mocha": "^6.2.2",
"mock-fs": "^4.10.2",
"mssql": "^5.1.0",
"mysql": "^2.17.1",
"mysql2": "^1.7.0",
Expand All @@ -82,7 +82,7 @@
"tap-spec": "^5.0.0",
"tape": "^4.11.0",
"toxiproxy-node-client": "^2.0.6",
"typescript": "^3.6.3",
"typescript": "^3.6.4",
"webpack-cli": "^3.3.9"
},
"buildDependencies": [
Expand Down
4 changes: 1 addition & 3 deletions test/cli/cli-test-utils.js
Expand Up @@ -58,9 +58,7 @@ function expectContentMatchesStub(stubPath, globPath, fileHelper) {
// accepts full or relative stub path
const relativeStubPath = stubPath.replace('test/jake-util/', '');
const stubContent = fileHelper.getFileTextContent(relativeStubPath);
const [content] = fileHelper.getFileGlobTextContent(
globPath
);
const [content] = fileHelper.getFileGlobTextContent(globPath);

expect(content).equals(stubContent);
}
Expand Down
32 changes: 18 additions & 14 deletions test/integration/schema/index.js
Expand Up @@ -1383,7 +1383,7 @@ module.exports = function(knex) {
}
});

context('when table is created using raw create table', function () {
context('when table is created using raw create table', function() {
beforeEach(async function() {
await knex.schema.raw(`create table TEST(
"i0" integer,
Expand All @@ -1403,17 +1403,17 @@ module.exports = function(knex) {
return knex.schema.dropTable('TEST');
});

const getCreateTableExpr = async () => (
await knex.schema.raw('select name, sql from sqlite_master where type = "table" and name = "TEST"')
)[0].sql;
const getCreateTableExpr = async () =>
(await knex.schema.raw(
'select name, sql from sqlite_master where type = "table" and name = "TEST"'
))[0].sql;

const dropCol = (colName) =>
knex.schema.alterTable('TEST', function(tbl) {
return tbl.dropColumn(colName);
});

const hasCol = (colName) =>
knex.schema.hasColumn('TEST', colName);
const hasCol = (colName) => knex.schema.hasColumn('TEST', colName);

it('drops the column', async function() {
await dropCol('i0');
Expand All @@ -1430,13 +1430,13 @@ module.exports = function(knex) {
// Foreign key on i1 should also be dropped:
expect(await getCreateTableExpr()).to.equal(
'CREATE TABLE TEST([i2] integer, `i3` integer, i4 integer, I5 integer, ' +
'unique(i4, i5), constraint i0 primary key([i3], "i4"), unique([i2]))'
'unique(i4, i5), constraint i0 primary key([i3], "i4"), unique([i2]))'
);
await dropCol('i2');
expect(await hasCol('i2')).to.equal(false);
expect(await getCreateTableExpr()).to.equal(
'CREATE TABLE TEST(`i3` integer, i4 integer, I5 integer, ' +
'unique(i4, i5), constraint i0 primary key([i3], "i4"))'
'unique(i4, i5), constraint i0 primary key([i3], "i4"))'
);
await dropCol('i3');
expect(await hasCol('i3')).to.equal(false);
Expand All @@ -1449,12 +1449,16 @@ module.exports = function(knex) {
'CREATE TABLE TEST(I5 integer)'
);
let lastColDeletionError;
await knex.schema.alterTable('TEST', function(tbl) {
return tbl.dropColumn('i5');
}).catch(e => {
lastColDeletionError = e;
})
expect(lastColDeletionError.message).to.eql('Unable to drop last column from table');
await knex.schema
.alterTable('TEST', function(tbl) {
return tbl.dropColumn('i5');
})
.catch((e) => {
lastColDeletionError = e;
});
expect(lastColDeletionError.message).to.eql(
'Unable to drop last column from table'
);
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion test/jake-util/knexfile-stubs/knexfile.js
Expand Up @@ -9,6 +9,6 @@ module.exports = {
},
seeds: {
directory: __dirname + '/../knexfile-stubs',
stub: 'seed.stub'
stub: 'seed.stub',
},
};
2 changes: 1 addition & 1 deletion test/jake-util/knexfile/knexfile.js
Expand Up @@ -8,5 +8,5 @@ module.exports = {
},
seeds: {
directory: __dirname + '/../knexfile_seeds',
}
},
};

1 comment on commit 1c65562

@mceachen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🎉

Please sign in to comment.