db-migrate-pg
Advanced tools
Comparing version 1.3.2 to 1.4.0
37
index.js
@@ -136,8 +136,14 @@ var util = require('util'); | ||
this.runSql( | ||
util.format('SET search_path TO `%s`', options.database), | ||
util.format('SET search_path TO %s', options.database), | ||
callback | ||
); | ||
} else if (typeof options.schema === 'string') { | ||
this.schema = options.schema; | ||
this.runSql( | ||
util.format('SET search_path TO %s', options.schema), | ||
callback | ||
); | ||
} | ||
} else if (typeof options === 'string') { | ||
this.runSql(util.format('SET search_path TO `%s`', options), callback); | ||
this.runSql(util.format('SET search_path TO %s', options), callback); | ||
} else callback(null); | ||
@@ -660,2 +666,23 @@ }, | ||
/** | ||
* We use the database clock if available, to set run_on. | ||
*/ | ||
_updateKV: function (table, key, value) { | ||
return this.runSql( | ||
`UPDATE ${this.escapeDDL(table)} SET ${this.escapeDDL('value')} = ?, | ||
${this.escapeDDL('run_on')} = NOW() | ||
WHERE ${this.escapeDDL('key')} = ?`, | ||
[value, key] | ||
); | ||
}, | ||
_updateKVC: function (table, key, value, c, v) { | ||
return this.runSql( | ||
`UPDATE ${this.escapeDDL(table)} SET ${this.escapeDDL('value')} = ?, | ||
${this.escapeDDL('run_on')} = NOW() | ||
WHERE ${this.escapeDDL('key')} = ? AND ${this.escapeDDL(c)} = ?`, | ||
[value, key, v] | ||
); | ||
}, | ||
all: function (...params) { | ||
@@ -707,5 +734,5 @@ let cb; | ||
} else if (config.ssl?.sslmode) { | ||
if(config.ssl.sslrootcert) config.ssl.ca = fs.readFileSync(config.ssl.sslrootcert).toString(); | ||
if(config.ssl.sslcert) config.ssl.cert = fs.readFileSync(config.ssl.sslcert).toString(); | ||
if(config.ssl.sslkey) config.ssl.key = fs.readFileSync(config.ssl.sslkey).toString(); | ||
if (config.ssl.sslrootcert) config.ssl.ca = fs.readFileSync(config.ssl.sslrootcert).toString(); | ||
if (config.ssl.sslcert) config.ssl.cert = fs.readFileSync(config.ssl.sslcert).toString(); | ||
if (config.ssl.sslkey) config.ssl.key = fs.readFileSync(config.ssl.sslkey).toString(); | ||
} | ||
@@ -712,0 +739,0 @@ if (!config.database) { |
{ | ||
"name": "db-migrate-pg", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "A postgresql driver for db-migrate", | ||
@@ -41,4 +41,10 @@ "main": "index.js", | ||
"db-migrate-shared": "^1.1.2", | ||
"vows": "0.8.0" | ||
"vows": "0.8.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.3.1", | ||
"eslint-plugin-standard": "^4.1.0" | ||
} | ||
} |
30740
663
9