db-migrate 1.0.0-beta.19 → 1.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/learn.js +8 -9
  2. package/package.json +1 -1
package/lib/learn.js CHANGED
@@ -121,8 +121,8 @@ class STD {
121
121
  removeColumn (t, c, o = {}) {
122
122
  const alter = {};
123
123
  this.checkColumn(t, c);
124
- const hasColumns = this.schema[t].columns !== undefined
125
- const columns = hasColumns ? this.schema[t].columns ? this.schema[t];
124
+ const hasColumns = this.schema[t].columns !== undefined;
125
+ const columns = hasColumns ? this.schema[t].columns : this.schema[t];
126
126
 
127
127
  if (columns[c].notNull === true) {
128
128
  if (this.validations.columnStrategies !== true) {
@@ -202,11 +202,11 @@ class STD {
202
202
  this.modC.push({ t: 1, a: 'addColumn', c: [t, c, o] });
203
203
  }
204
204
 
205
- if(hasColumns) {
205
+ if (hasColumns) {
206
206
  delete this.schema[t].columns[c];
207
207
  } else {
208
208
  delete this.schema[t][c];
209
- }
209
+ }
210
210
 
211
211
  return Promise.resolve(alter);
212
212
  }
@@ -227,8 +227,8 @@ class STD {
227
227
  throw new Error(`There is no ${t} table in schema!`);
228
228
  }
229
229
  this.schema[t] = this.schema[t] || {};
230
- const hasColumns = this.schema[t].columns !== undefined
231
- const columns = hasColumns ? this.schema[t].columns ? this.schema[t];
230
+ const hasColumns = this.schema[t].columns !== undefined;
231
+ const columns = hasColumns ? this.schema[t].columns : this.schema[t];
232
232
 
233
233
  columns[c] = s;
234
234
 
@@ -242,9 +242,8 @@ const hasColumns = this.schema[t].columns !== undefined
242
242
 
243
243
  if (!this.modS[t]) this.modS[t] = {};
244
244
 
245
- const hasColumns = this.schema[t].columns !== undefined
246
- const columns = hasColumns ? this.schema[t].columns ? this.schema[t];
247
-
245
+ const hasColumns = this.schema[t].columns !== undefined;
246
+ const columns = hasColumns ? this.schema[t].columns : this.schema[t];
248
247
 
249
248
  this.modS[t][c] = columns[c];
250
249
  columns[c] = Object.assign(columns[c], s);
package/package.json CHANGED
@@ -31,7 +31,7 @@
31
31
  "programable",
32
32
  "api"
33
33
  ],
34
- "version": "1.0.0-beta.19",
34
+ "version": "1.0.0-beta.20",
35
35
  "engines": {
36
36
  "node": ">=8.0.0"
37
37
  },