@@ -863,8 +863,7 @@ export class PostgresStorageAdapter {
863
863
// rejection reason are TBD.
864
864
getAllClasses ( ) {
865
865
return this . _ensureSchemaCollectionExists ( )
866
- . then ( ( ) => this . _client . map ( 'SELECT * FROM "_SCHEMA"' , null , row => ( { className : row . className , ...row . schema } ) ) )
867
- . then ( res => res . map ( toParseSchema ) )
866
+ . then ( ( ) => this . _client . map ( 'SELECT * FROM "_SCHEMA"' , null , row => toParseSchema ( { className : row . className , ...row . schema } ) ) ) ;
868
867
}
869
868
870
869
// Return a promise for the schema with the given name, in Parse format. If
@@ -1401,7 +1400,7 @@ export class PostgresStorageAdapter {
1401
1400
const constraintName = `unique_${ fieldNames . sort ( ) . join ( '_' ) } ` ;
1402
1401
const constraintPatterns = fieldNames . map ( ( fieldName , index ) => `$${ index + 3 } :name` ) ;
1403
1402
const qs = `ALTER TABLE $1:name ADD CONSTRAINT $2:name UNIQUE (${ constraintPatterns . join ( ',' ) } )` ;
1404
- return this . _client . none ( qs , [ className , constraintName , ...fieldNames ] )
1403
+ return this . _client . none ( qs , [ className , constraintName , ...fieldNames ] )
1405
1404
. catch ( error => {
1406
1405
if ( error . code === PostgresDuplicateRelationError && error . message . includes ( constraintName ) ) {
1407
1406
// Index already exists. Ignore error.
@@ -1552,8 +1551,7 @@ export class PostgresStorageAdapter {
1552
1551
1553
1552
const qs = `SELECT ${ columns } FROM $1:name ${ wherePattern } ${ sortPattern } ${ limitPattern } ${ skipPattern } ${ groupPattern } ` ;
1554
1553
debug ( qs , values ) ;
1555
- return this . _client . any ( qs , values )
1556
- . then ( results => results . map ( object => this . postgresObjectToParseObject ( className , object , schema ) ) )
1554
+ return this . _client . map ( qs , values , a => this . postgresObjectToParseObject ( className , a , schema ) )
1557
1555
. then ( results => {
1558
1556
if ( countField ) {
1559
1557
results [ 0 ] [ countField ] = parseInt ( results [ 0 ] [ countField ] , 10 ) ;
@@ -1579,7 +1577,7 @@ export class PostgresStorageAdapter {
1579
1577
} ) ;
1580
1578
return Promise . all ( promises )
1581
1579
. then ( ( ) => {
1582
- return this . _client . tx ( t => {
1580
+ return this . _client . tx ( 'perform-initialization' , t => {
1583
1581
return t . batch ( [
1584
1582
t . none ( sql . misc . jsonObjectSetKeys ) ,
1585
1583
t . none ( sql . array . add ) ,
0 commit comments