db-migrate-pg
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -0,1 +1,12 @@ | ||
<a name="0.4.0"></a> | ||
# [0.4.0](https://github.com/db-migrate/pg/compare/v0.3.1...v0.4.0) (2018-04-02) | ||
### Bug Fixes | ||
* **version:** fallback to string based check ([8b6b958](https://github.com/db-migrate/pg/commit/8b6b958)), closes [#32](https://github.com/db-migrate/pg/issues/32) | ||
* **version:** use server_version_num instead of server_version ([ba07af7](https://github.com/db-migrate/pg/commit/ba07af7)) | ||
<a name="0.3.1"></a> | ||
@@ -2,0 +13,0 @@ ## [0.3.1](https://github.com/db-migrate/pg/compare/v0.3.0...v0.3.1) (2018-02-11) |
41
index.js
@@ -163,3 +163,3 @@ var util = require('util'); | ||
return this.all('show server_version') | ||
return this.all('show server_version_num') | ||
.then( | ||
@@ -169,10 +169,10 @@ function (result) { | ||
result && | ||
result && | ||
result.length > 0 && | ||
result[0].server_version | ||
result[0].server_version_num | ||
) { | ||
var version = result[0].server_version; | ||
if (version.split('.').length !== 3) { | ||
version += '.0'; | ||
} | ||
var version = result[0].server_version_num; | ||
var major = Math.floor(version / 10000); | ||
var minor = Math.floor((version - major * 10000) / 100); | ||
var patch = Math.floor(version - major * 10000 - minor * 100); | ||
version = major + '.' + minor + '.' + patch | ||
options.ifNotExists = semver.gte(version, '9.1.0'); | ||
@@ -186,2 +186,29 @@ } | ||
) | ||
.catch( | ||
// not all DBs support server_version_num, fall back to server_version | ||
function () { | ||
return this.all('show server_version') | ||
.then( | ||
function (result) { | ||
if ( | ||
result && | ||
result.length > 0 && | ||
result[0].server_version | ||
) { | ||
var version = result[0].server_version; | ||
// handle versions like “10.2 (Ubuntu 10.2)” | ||
version = version.split(' ')[0]; | ||
// handle missing patch numbers | ||
if (version.split('.').length !== 3) { | ||
version += '.0'; | ||
} | ||
options.ifNotExists = semver.gte(version, '9.1.0'); | ||
// Get the current search path so we can change the current | ||
// schema if necessary | ||
return this.all('SHOW search_path'); | ||
} | ||
}.bind(this) | ||
) | ||
}.bind(this) | ||
) | ||
.then( | ||
@@ -188,0 +215,0 @@ function (result) { |
{ | ||
"name": "db-migrate-pg", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "A postgresql driver for db-migrate", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25917
581
0