Skip to content

Commit 755c494

Browse files
snyk-botdplewis
andauthored
[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 <[email protected]>
1 parent e143fb1 commit 755c494

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

package-lock.json

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"mustache": "4.2.0",
5050
"parse": "3.1.0",
5151
"pg-monitor": "1.4.1",
52-
"pg-promise": "10.9.2",
52+
"pg-promise": "10.10.1",
5353
"pluralize": "8.0.0",
5454
"redis": "3.1.1",
5555
"semver": "7.3.4",

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -1056,28 +1056,25 @@ export class PostgresStorageAdapter implements StorageAdapter {
10561056
conn = conn || this._client;
10571057
const self = this;
10581058

1059-
await conn.tx('schema-upgrade', async t => {
1059+
await conn.task('schema-upgrade', async t => {
10601060
const columns = await t.map(
10611061
'SELECT column_name FROM information_schema.columns WHERE table_name = $<className>',
10621062
{ className },
10631063
a => a.column_name
10641064
);
10651065
const newColumns = Object.keys(schema.fields)
10661066
.filter(item => columns.indexOf(item) === -1)
1067-
.map(fieldName =>
1068-
self.addFieldIfNotExists(className, fieldName, schema.fields[fieldName], t)
1069-
);
1067+
.map(fieldName => self.addFieldIfNotExists(className, fieldName, schema.fields[fieldName]));
10701068

10711069
await t.batch(newColumns);
10721070
});
10731071
}
10741072

1075-
async addFieldIfNotExists(className: string, fieldName: string, type: any, conn: any) {
1073+
async addFieldIfNotExists(className: string, fieldName: string, type: any) {
10761074
// TODO: Must be revised for invalid logic...
10771075
debug('addFieldIfNotExists');
1078-
conn = conn || this._client;
10791076
const self = this;
1080-
await conn.tx('add-field-if-not-exists', async t => {
1077+
await this._client.tx('add-field-if-not-exists', async t => {
10811078
if (type.type !== 'Relation') {
10821079
try {
10831080
await t.none(

0 commit comments

Comments
 (0)