db-migrate
Advanced tools
Comparing version 1.0.0-beta.18 to 1.0.0-beta.19
@@ -95,15 +95,20 @@ var internals = {}; | ||
var connect = function (config) { | ||
driver.connect(config, intern, function (err, db) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
log.verbose('connected'); | ||
driver.connect( | ||
// safe disconnect of our config object into userspace | ||
JSON.parse(JSON.stringify(config)), | ||
intern, | ||
function (err, db) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
log.verbose('connected'); | ||
if (!global.immunity) { | ||
db = Shadow.infect(db, internals, ShadowProto); | ||
if (!global.immunity) { | ||
db = Shadow.infect(db, internals, ShadowProto); | ||
} | ||
callback(null, db); | ||
} | ||
callback(null, db); | ||
}); | ||
); | ||
}; | ||
@@ -128,7 +133,8 @@ | ||
if (plugin) { | ||
tunnel = plugin[ | ||
`connection:tunnel:${ | ||
tunnelType && tunnelType !== 'ssh' ? tunnelType : 'ssh' | ||
}` | ||
](tunnelConfig); | ||
tunnel = | ||
plugin[ | ||
`connection:tunnel:${ | ||
tunnelType && tunnelType !== 'ssh' ? tunnelType : 'ssh' | ||
}` | ||
](tunnelConfig); | ||
} | ||
@@ -135,0 +141,0 @@ |
@@ -11,3 +11,3 @@ const Promise = require('bluebird'); | ||
if (!this.schema[t][c]) { | ||
if (!this.schema[t][c] && !this.schema[t].columns[c]) { | ||
throw new Error(`There is no ${c} column in schema!`); | ||
@@ -125,4 +125,6 @@ } | ||
this.checkColumn(t, c); | ||
const hasColumns = this.schema[t].columns !== undefined | ||
const columns = hasColumns ? this.schema[t].columns ? this.schema[t]; | ||
if (this.schema[t][c].notNull === true) { | ||
if (columns[c].notNull === true) { | ||
if (this.validations.columnStrategies !== true) { | ||
@@ -175,6 +177,6 @@ if ( | ||
if (this.schema[t][c].notNull === true) { | ||
if (columns[c].notNull === true) { | ||
switch (o.columnStrategy) { | ||
case 'delay': | ||
this.modS[t][c] = this.schema[t][c]; | ||
this.modS[t][c] = columns[c]; | ||
@@ -194,3 +196,3 @@ o.passthrough = o.passthrough || {}; | ||
case 'defaultValue': | ||
this.modS[t][c] = this.schema[t][c]; | ||
this.modS[t][c] = columns[c]; | ||
this.modS[t][c].defaultValue = o.passthrough.defaultValue; | ||
@@ -202,3 +204,3 @@ | ||
} else { | ||
this.modS[t][c] = this.schema[t][c]; | ||
this.modS[t][c] = columns[c]; | ||
@@ -208,3 +210,7 @@ this.modC.push({ t: 1, a: 'addColumn', c: [t, c, o] }); | ||
delete this.schema[t][c]; | ||
if(hasColumns) { | ||
delete this.schema[t].columns[c]; | ||
} else { | ||
delete this.schema[t][c]; | ||
} | ||
@@ -230,4 +236,7 @@ return Promise.resolve(alter); | ||
this.schema[t] = this.schema[t] || {}; | ||
this.schema[t][c] = s; | ||
const hasColumns = this.schema[t].columns !== undefined | ||
const columns = hasColumns ? this.schema[t].columns ? this.schema[t]; | ||
columns[c] = s; | ||
this.modC.push({ t: 0, a: 'removeColumn', c: [t, c] }); | ||
@@ -243,5 +252,9 @@ | ||
this.modS[t][c] = this.schema[t][c]; | ||
this.schema[t][c] = Object.assign(this.schema[t][c], s); | ||
const hasColumns = this.schema[t].columns !== undefined | ||
const columns = hasColumns ? this.schema[t].columns ? this.schema[t]; | ||
this.modS[t][c] = columns[c]; | ||
columns[c] = Object.assign(columns[c], s); | ||
this.modC.push({ t: 1, a: 'changeColumn', c: [t, c] }); | ||
@@ -248,0 +261,0 @@ |
@@ -55,3 +55,3 @@ const Promise = require('bluebird'); | ||
`This index did not exist at the time of deleting it. ` + | ||
`This can happen if an index was created by hand and then deleted` + | ||
`This can happen if an index was created by hand and then deleted ` + | ||
`by db-migrate. Make sure to recreate it by hand to avoid any problems.` | ||
@@ -58,0 +58,0 @@ ); |
@@ -34,3 +34,3 @@ { | ||
], | ||
"version": "1.0.0-beta.18", | ||
"version": "1.0.0-beta.19", | ||
"engines": { | ||
@@ -57,6 +57,6 @@ "node": ">=8.0.0" | ||
"rc": "^1.2.8", | ||
"resolve": "^1.1.6", | ||
"resolve": "^1.19.0", | ||
"semver": "^5.3.0", | ||
"tunnel-ssh": "^4.0.0", | ||
"yargs": "^15.3.1" | ||
"yargs": "^17.5.1" | ||
}, | ||
@@ -63,0 +63,0 @@ "devDependencies": { |
[![Backers on Open Collective](https://opencollective.com/node-db-migrate/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/node-db-migrate/sponsors/badge.svg)](#sponsors) | ||
[![Build Status](https://travis-ci.org/db-migrate/node-db-migrate.svg?branch=master)](https://travis-ci.org/db-migrate/node-db-migrate) | ||
[![Build Status](https://github.com/db-migrate/node-db-migrate/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/db-migrate/node-db-migrate/actions/workflows/ci.yml) | ||
[![Dependency Status](https://david-dm.org/db-migrate/node-db-migrate.svg)](https://david-dm.org/db-migrate/node-db-migrate) | ||
@@ -4,0 +4,0 @@ [![devDependency Status](https://david-dm.org/db-migrate/node-db-migrate/dev-status.svg)](https://david-dm.org/db-migrate/node-db-migrate#info=devDependencies) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3905
128134
47
+ Addedcliui@8.0.1(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@17.7.2(transitive)
+ Addedyargs-parser@21.1.1(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcliui@6.0.0(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedfind-up@4.1.0(transitive)
- Removedlocate-path@5.0.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedrequire-main-filename@2.0.0(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwrap-ansi@6.2.0(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyargs@15.4.1(transitive)
- Removedyargs-parser@18.1.3(transitive)
Updatedresolve@^1.19.0
Updatedyargs@^17.5.1