Skip to content

Commit 7d7f823

Browse files
committed
deprecate node <8
Signed-off-by: Tobias Gurtzick <[email protected]>
1 parent 57cf97c commit 7d7f823

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: node_js
22

33
node_js:
4-
- 6
54
- 8
65
- 10
76
- node

lib/learn.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ const Promise = require('bluebird');
22
const Shadow = require('./driver/shadow');
33

44
class STD {
5-
constructor ({ schema, modSchema: mod }) {
5+
constructor ({ schema, modSchema: mod }, driver) {
6+
this.driver = driver;
67
this.indizies = schema.i;
78
this.schema = schema.c;
89
this.foreign = schema.f;
@@ -93,9 +94,22 @@ class STD {
9394
return this.createTable.apply(this, args);
9495
}
9596

96-
removeColumn (t, c) {
97+
removeColumn (t, c, o) {
9798
let alter = {};
9899
if (this.schema[t]) {
100+
if (this.schema[t][c].notNull === true) {
101+
if (this.driver._meta.supports.optionParam === true) {
102+
throw new Error(
103+
'Can not drop a notNull column without providing a' +
104+
' recreation strategy.'
105+
);
106+
} else {
107+
throw new Error(
108+
'This driver does not support optionParameters which are' +
109+
' required to provide a recreation strategy.'
110+
);
111+
}
112+
}
99113
this.modS[t] = {};
100114
this.modS[t][c] = this.schema[t][c];
101115
delete this.schema[t][c];
@@ -265,14 +279,14 @@ const noLearnError = prop => {
265279
module.exports = {
266280
getInterface: (context, file, driver, internals) => {
267281
if (context.learnable) {
268-
const _std = new STD(internals);
282+
const _std = new STD(internals, context);
269283
return Shadow.overshadow(
270284
driver,
271285
Object.assign(_std, context.learnable),
272286
noLearnError
273287
);
274288
}
275289

276-
return Shadow.overshadow(driver, new STD(internals), noLearnError);
290+
return Shadow.overshadow(driver, new STD(internals, context), noLearnError);
277291
}
278292
};

0 commit comments

Comments
 (0)