db-migrate/pg

Fails to assert pg version correctly

Opened this issue · 0 comments

bttf commented

Related to #32; when PG produces a version like one below, the regex matcher matches on the wrong string, causing the following error to occur:

[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Invalid Version: 0.18.04
    at module.exports (/home/bttf/wyl-today/node_modules/db-migrate/lib/commands/helper/assert.js:9:14)
    at /home/bttf/wyl-today/node_modules/db-migrate/lib/commands/up.js:29:16
    at new SemVer (/home/bttf/wyl-today/node_modules/semver/semver.js:323:11)
    at compare (/home/bttf/wyl-today/node_modules/semver/semver.js:614:10)
    at Function.gte (/home/bttf/wyl-today/node_modules/semver/semver.js:663:10)
    at Object.<anonymous> (/home/bttf/wyl-today/node_modules/db-migrate-pg/index.js:171:43)
    at tryCatcher (/home/bttf/wyl-today/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/bttf/wyl-today/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/home/bttf/wyl-today/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/home/bttf/wyl-today/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/home/bttf/wyl-today/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/home/bttf/wyl-today/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/home/bttf/wyl-today/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/home/bttf/wyl-today/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/bttf/wyl-today/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:456:21)

Version output

pgdb=# select  version() as version;
                                                                version
----------------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 10.12 (Ubuntu 10.12-0ubuntu0.18.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0, 64-bit

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.