[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:
24
package-lock.json
generated
24
package-lock.json
generated
@@ -10131,9 +10131,9 @@
|
||||
}
|
||||
},
|
||||
"pg-connection-string": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.4.0.tgz",
|
||||
"integrity": "sha512-3iBXuv7XKvxeMrIgym7njT+HlZkwZqqGX4Bu9cci8xHZNT+Um1gWKqCsAzcC0d95rcKMU5WBg6YRUcHyV0HZKQ=="
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz",
|
||||
"integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ=="
|
||||
},
|
||||
"pg-int8": {
|
||||
"version": "1.0.1",
|
||||
@@ -10154,14 +10154,14 @@
|
||||
}
|
||||
},
|
||||
"pg-pool": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.2.2.tgz",
|
||||
"integrity": "sha512-ORJoFxAlmmros8igi608iVEbQNNZlp89diFVx6yV5v+ehmpMY9sK6QgpmgoXbmkNaBAx8cOOZh9g80kJv1ooyA=="
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.3.0.tgz",
|
||||
"integrity": "sha512-0O5huCql8/D6PIRFAlmccjphLYWC+JIzvUhSzXSpGaf+tjTZc4nn+Lr7mLXBbFJfvwbP0ywDv73EiaBsxn7zdg=="
|
||||
},
|
||||
"pg-promise": {
|
||||
"version": "10.9.2",
|
||||
"resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-10.9.2.tgz",
|
||||
"integrity": "sha512-ewelfzZeSPe5sbgd5ylB6edVXqoD8AH/fqZj4wPLL0242vXtkFY3JuUqt3mfvTruOqZHhoINpoXTfmC9UXbZ7A==",
|
||||
"version": "10.10.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-10.10.1.tgz",
|
||||
"integrity": "sha512-sopmuOr2PrUNh3XI0Y15ssmjcwhZnGHyGYwuDDmWFnBydq7lvrhTMBI3hefAp3YMx07+HSXfSpJse9z5vC4bsw==",
|
||||
"requires": {
|
||||
"assert-options": "0.7.0",
|
||||
"pg": "8.5.1",
|
||||
@@ -10170,9 +10170,9 @@
|
||||
}
|
||||
},
|
||||
"pg-protocol": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.4.0.tgz",
|
||||
"integrity": "sha512-El+aXWcwG/8wuFICMQjM5ZSAm6OWiJicFdNYo+VY3QP+8vI4SvLIWVe51PppTzMhikUJR+PsyIFKqfdXPz/yxA=="
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.5.0.tgz",
|
||||
"integrity": "sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ=="
|
||||
},
|
||||
"pg-types": {
|
||||
"version": "2.2.0",
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"mustache": "4.2.0",
|
||||
"parse": "3.1.0",
|
||||
"pg-monitor": "1.4.1",
|
||||
"pg-promise": "10.9.2",
|
||||
"pg-promise": "10.10.1",
|
||||
"pluralize": "8.0.0",
|
||||
"redis": "3.1.1",
|
||||
"semver": "7.3.4",
|
||||
|
||||
@@ -1056,7 +1056,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
||||
conn = conn || this._client;
|
||||
const self = this;
|
||||
|
||||
await conn.tx('schema-upgrade', async t => {
|
||||
await conn.task('schema-upgrade', async t => {
|
||||
const columns = await t.map(
|
||||
'SELECT column_name FROM information_schema.columns WHERE table_name = $<className>',
|
||||
{ className },
|
||||
@@ -1064,20 +1064,17 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
||||
);
|
||||
const newColumns = Object.keys(schema.fields)
|
||||
.filter(item => columns.indexOf(item) === -1)
|
||||
.map(fieldName =>
|
||||
self.addFieldIfNotExists(className, fieldName, schema.fields[fieldName], t)
|
||||
);
|
||||
.map(fieldName => self.addFieldIfNotExists(className, fieldName, schema.fields[fieldName]));
|
||||
|
||||
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...
|
||||
debug('addFieldIfNotExists');
|
||||
conn = conn || this._client;
|
||||
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') {
|
||||
try {
|
||||
await t.none(
|
||||
|
||||
Reference in New Issue
Block a user