Skip to content

Commit

Permalink
deprecate node <8
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Gurtzick <magic@wizardtales.com>
  • Loading branch information
wzrdtales committed May 16, 2019
1 parent 57cf97c commit 7d7f823
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: node_js

node_js:
- 6
- 8
- 10
- node
Expand Down
22 changes: 18 additions & 4 deletions lib/learn.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const Promise = require('bluebird');
const Shadow = require('./driver/shadow');

class STD {
constructor ({ schema, modSchema: mod }) {
constructor ({ schema, modSchema: mod }, driver) {
this.driver = driver;
this.indizies = schema.i;
this.schema = schema.c;
this.foreign = schema.f;
Expand Down Expand Up @@ -93,9 +94,22 @@ class STD {
return this.createTable.apply(this, args);
}

removeColumn (t, c) {
removeColumn (t, c, o) {
let alter = {};
if (this.schema[t]) {
if (this.schema[t][c].notNull === true) {
if (this.driver._meta.supports.optionParam === true) {
throw new Error(
'Can not drop a notNull column without providing a' +
' recreation strategy.'
);
} else {
throw new Error(
'This driver does not support optionParameters which are' +
' required to provide a recreation strategy.'
);
}
}
this.modS[t] = {};
this.modS[t][c] = this.schema[t][c];
delete this.schema[t][c];
Expand Down Expand Up @@ -265,14 +279,14 @@ const noLearnError = prop => {
module.exports = {
getInterface: (context, file, driver, internals) => {
if (context.learnable) {
const _std = new STD(internals);
const _std = new STD(internals, context);
return Shadow.overshadow(
driver,
Object.assign(_std, context.learnable),
noLearnError
);
}

return Shadow.overshadow(driver, new STD(internals), noLearnError);
return Shadow.overshadow(driver, new STD(internals, context), noLearnError);
}
};

0 comments on commit 7d7f823

Please sign in to comment.