[Snyk] Upgrade pg-promise from 10.9.2 to 10.10.1 (#7286)

* fix: upgrade pg-promise from 10.9.2 to 10.9.3

Snyk has created this PR to upgrade pg-promise from 10.9.2 to 10.9.3.

See this package in npm:
https://www.npmjs.com/package/pg-promise

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

* bump pg-promise to 10.10.1

* fix add field if not exists

* lint

Co-authored-by: Diamond Lewis <findlewis@gmail.com>
This commit is contained in:
Snyk bot
2021-04-29 20:10:15 +03:00
committed by GitHub
parent e143fb1bf6
commit 755c49404d
3 changed files with 17 additions and 20 deletions

24
package-lock.json generated
View File

@@ -10131,9 +10131,9 @@
} }
}, },
"pg-connection-string": { "pg-connection-string": {
"version": "2.4.0", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.4.0.tgz", "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz",
"integrity": "sha512-3iBXuv7XKvxeMrIgym7njT+HlZkwZqqGX4Bu9cci8xHZNT+Um1gWKqCsAzcC0d95rcKMU5WBg6YRUcHyV0HZKQ==" "integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ=="
}, },
"pg-int8": { "pg-int8": {
"version": "1.0.1", "version": "1.0.1",
@@ -10154,14 +10154,14 @@
} }
}, },
"pg-pool": { "pg-pool": {
"version": "3.2.2", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.2.2.tgz", "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.3.0.tgz",
"integrity": "sha512-ORJoFxAlmmros8igi608iVEbQNNZlp89diFVx6yV5v+ehmpMY9sK6QgpmgoXbmkNaBAx8cOOZh9g80kJv1ooyA==" "integrity": "sha512-0O5huCql8/D6PIRFAlmccjphLYWC+JIzvUhSzXSpGaf+tjTZc4nn+Lr7mLXBbFJfvwbP0ywDv73EiaBsxn7zdg=="
}, },
"pg-promise": { "pg-promise": {
"version": "10.9.2", "version": "10.10.1",
"resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-10.9.2.tgz", "resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-10.10.1.tgz",
"integrity": "sha512-ewelfzZeSPe5sbgd5ylB6edVXqoD8AH/fqZj4wPLL0242vXtkFY3JuUqt3mfvTruOqZHhoINpoXTfmC9UXbZ7A==", "integrity": "sha512-sopmuOr2PrUNh3XI0Y15ssmjcwhZnGHyGYwuDDmWFnBydq7lvrhTMBI3hefAp3YMx07+HSXfSpJse9z5vC4bsw==",
"requires": { "requires": {
"assert-options": "0.7.0", "assert-options": "0.7.0",
"pg": "8.5.1", "pg": "8.5.1",
@@ -10170,9 +10170,9 @@
} }
}, },
"pg-protocol": { "pg-protocol": {
"version": "1.4.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.4.0.tgz", "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.5.0.tgz",
"integrity": "sha512-El+aXWcwG/8wuFICMQjM5ZSAm6OWiJicFdNYo+VY3QP+8vI4SvLIWVe51PppTzMhikUJR+PsyIFKqfdXPz/yxA==" "integrity": "sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ=="
}, },
"pg-types": { "pg-types": {
"version": "2.2.0", "version": "2.2.0",

View File

@@ -49,7 +49,7 @@
"mustache": "4.2.0", "mustache": "4.2.0",
"parse": "3.1.0", "parse": "3.1.0",
"pg-monitor": "1.4.1", "pg-monitor": "1.4.1",
"pg-promise": "10.9.2", "pg-promise": "10.10.1",
"pluralize": "8.0.0", "pluralize": "8.0.0",
"redis": "3.1.1", "redis": "3.1.1",
"semver": "7.3.4", "semver": "7.3.4",

View File

@@ -1056,7 +1056,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
conn = conn || this._client; conn = conn || this._client;
const self = this; const self = this;
await conn.tx('schema-upgrade', async t => { await conn.task('schema-upgrade', async t => {
const columns = await t.map( const columns = await t.map(
'SELECT column_name FROM information_schema.columns WHERE table_name = $<className>', 'SELECT column_name FROM information_schema.columns WHERE table_name = $<className>',
{ className }, { className },
@@ -1064,20 +1064,17 @@ export class PostgresStorageAdapter implements StorageAdapter {
); );
const newColumns = Object.keys(schema.fields) const newColumns = Object.keys(schema.fields)
.filter(item => columns.indexOf(item) === -1) .filter(item => columns.indexOf(item) === -1)
.map(fieldName => .map(fieldName => self.addFieldIfNotExists(className, fieldName, schema.fields[fieldName]));
self.addFieldIfNotExists(className, fieldName, schema.fields[fieldName], t)
);
await t.batch(newColumns); await t.batch(newColumns);
}); });
} }
async addFieldIfNotExists(className: string, fieldName: string, type: any, conn: any) { async addFieldIfNotExists(className: string, fieldName: string, type: any) {
// TODO: Must be revised for invalid logic... // TODO: Must be revised for invalid logic...
debug('addFieldIfNotExists'); debug('addFieldIfNotExists');
conn = conn || this._client;
const self = this; const self = this;
await conn.tx('add-field-if-not-exists', async t => { await this._client.tx('add-field-if-not-exists', async t => {
if (type.type !== 'Relation') { if (type.type !== 'Relation') {
try { try {
await t.none( await t.none(