@@ -1029,7 +1029,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1029
1029
const qs = `CREATE TABLE IF NOT EXISTS $1:name (${ patternsArray . join ( ) } )` ;
1030
1030
const values = [ className , ...valuesArray ] ;
1031
1031
1032
- await conn . task ( 'create-table' , async t => {
1032
+ return conn . task ( 'create-table' , async t => {
1033
1033
try {
1034
1034
await t . none ( qs , values ) ;
1035
1035
} catch ( error ) {
@@ -1952,7 +1952,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1952
1952
const constraintName = ` $ { className } _unique_$ { fieldNames . sort ( ) . join ( '_' ) } `;
1953
1953
const constraintPatterns = fieldNames . map ( ( fieldName , index ) => `$${ index + 3 } :name` ) ;
1954
1954
const qs = `CREATE UNIQUE INDEX IF NOT EXISTS $2 :name ON $1 :name ( $ { constraintPatterns . join ( ) } ) `;
1955
- await this._client.none(qs, [className, constraintName, ...fieldNames]).catch(error => {
1955
+ return this._client.none(qs, [className, constraintName, ...fieldNames]).catch(error => {
1956
1956
if (error.code === PostgresDuplicateRelationError && error.message.includes(constraintName)) {
1957
1957
// Index already exists. Ignore error.
1958
1958
} else if (
@@ -2302,7 +2302,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
2302
2302
.then(() => this.schemaUpgrade(schema.className, schema));
2303
2303
});
2304
2304
promises.push(this._listenToSchema());
2305
- await Promise.all(promises)
2305
+ return Promise.all(promises)
2306
2306
.then(() => {
2307
2307
return this._client.tx('perform-initialization', async t => {
2308
2308
await t.none(sql.misc.jsonObjectSetKeys);
@@ -2447,7 +2447,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
2447
2447
): Promise<any> {
2448
2448
const conn = options.conn !== undefined ? options.conn : this._client;
2449
2449
const qs = 'DROP FUNCTION IF EXISTS idempodency_delete_old_rows()';
2450
- await conn
2450
+ return conn
2451
2451
.none(qs)
2452
2452
.catch(error => {
2453
2453
throw error;
@@ -2460,7 +2460,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
2460
2460
const conn = options.conn !== undefined ? options.conn : this._client;
2461
2461
const ttlOptions = options.ttl !== undefined ? ` $ { options . ttl } seconds ` : '60 seconds';
2462
2462
const qs = 'CREATE OR REPLACE FUNCTION idempodency_delete_old_rows() RETURNS void LANGUAGE plpgsql AS $$ BEGIN DELETE FROM "_Idempotency" WHERE expire < NOW() - INTERVAL $1; END; $$;';
2463
- await conn
2463
+ return conn
2464
2464
.none(qs, [ttlOptions])
2465
2465
.catch(error => {
2466
2466
if (
0 commit comments