@@ -723,15 +723,15 @@ export class PostgresStorageAdapter {
723
723
} ) ;
724
724
const qs = `CREATE TABLE IF NOT EXISTS $1:name (${ patternsArray . join ( ) } )` ;
725
725
const values = [ className , ...valuesArray ] ;
726
-
726
+
727
727
return conn . task ( 'create-table' , function * ( t ) {
728
728
try {
729
729
yield self . _ensureSchemaCollectionExists ( t ) ;
730
730
yield t . none ( qs , values ) ;
731
731
} catch ( error ) {
732
- if ( error . code !== PostgresDuplicateRelationError ) {
733
- throw error ;
734
- }
732
+ if ( error . code !== PostgresDuplicateRelationError ) {
733
+ throw error ;
734
+ }
735
735
// ELSE: Table already exists, must have been created by a different request. Ignore the error.
736
736
}
737
737
yield t . tx ( 'create-table-tx' , tx => {
@@ -755,14 +755,14 @@ export class PostgresStorageAdapter {
755
755
postgresType : parseTypeToPostgresType ( type )
756
756
} ) ;
757
757
} catch ( error ) {
758
- if ( error . code === PostgresRelationDoesNotExistError ) {
759
- return yield self . createClass ( className , { fields : { [ fieldName ] : type } } , t ) ;
760
- }
761
- if ( error . code !== PostgresDuplicateColumnError ) {
762
- throw error ;
763
- }
764
- // Column already exists, created by other request. Carry on to see if it's the right type.
765
- } ;
758
+ if ( error . code === PostgresRelationDoesNotExistError ) {
759
+ return yield self . createClass ( className , { fields : { [ fieldName ] : type } } , t ) ;
760
+ }
761
+ if ( error . code !== PostgresDuplicateColumnError ) {
762
+ throw error ;
763
+ }
764
+ // Column already exists, created by other request. Carry on to see if it's the right type.
765
+ }
766
766
} else {
767
767
yield t . none ( 'CREATE TABLE IF NOT EXISTS $<joinTable:name> ("relatedId" varChar(120), "owningId" varChar(120), PRIMARY KEY("relatedId", "owningId") )' , { joinTable : `_Join:${ fieldName } :${ className } ` } ) ;
768
768
}
@@ -794,7 +794,7 @@ export class PostgresStorageAdapter {
794
794
const now = new Date ( ) . getTime ( ) ;
795
795
const helpers = this . _pgp . helpers ;
796
796
debug ( 'deleteAllClasses' ) ;
797
-
797
+
798
798
return this . _client . task ( 'delete-all-classes' , function * ( t ) {
799
799
try {
800
800
const results = yield t . any ( 'SELECT * FROM "_SCHEMA"' ) ;
@@ -811,8 +811,8 @@ export class PostgresStorageAdapter {
811
811
// No _SCHEMA collection. Don't delete anything.
812
812
}
813
813
} ) . then ( ( ) => {
814
- debug ( `deleteAllClasses done in ${ new Date ( ) . getTime ( ) - now } ` ) ;
815
- } ) ;
814
+ debug ( `deleteAllClasses done in ${ new Date ( ) . getTime ( ) - now } ` ) ;
815
+ } ) ;
816
816
}
817
817
818
818
// Remove the column and all the data. For Relations, the _Join collection is handled
@@ -860,7 +860,7 @@ export class PostgresStorageAdapter {
860
860
return this . _client . task ( 'get-all-classes' , function * ( t ) {
861
861
yield self . _ensureSchemaCollectionExists ( t ) ;
862
862
return yield t . map ( 'SELECT * FROM "_SCHEMA"' , null , row => toParseSchema ( { className : row . className , ...row . schema } ) ) ;
863
- } ) ;
863
+ } ) ;
864
864
}
865
865
866
866
// Return a promise for the schema with the given name, in Parse format. If
@@ -1500,7 +1500,6 @@ export class PostgresStorageAdapter {
1500
1500
columns . push ( `AVG(${ transformAggregateField ( value . $avg ) } ) AS "${ field } "` ) ;
1501
1501
}
1502
1502
}
1503
- columns . join ( ) ;
1504
1503
} else {
1505
1504
columns . push ( '*' ) ;
1506
1505
}
@@ -1546,7 +1545,7 @@ export class PostgresStorageAdapter {
1546
1545
}
1547
1546
}
1548
1547
1549
- const qs = `SELECT ${ columns } FROM $1:name ${ wherePattern } ${ sortPattern } ${ limitPattern } ${ skipPattern } ${ groupPattern } ` ;
1548
+ const qs = `SELECT ${ columns . join ( ) } FROM $1:name ${ wherePattern } ${ sortPattern } ${ limitPattern } ${ skipPattern } ${ groupPattern } ` ;
1550
1549
debug ( qs , values ) ;
1551
1550
return this . _client . map ( qs , values , a => this . postgresObjectToParseObject ( className , a , schema ) )
1552
1551
. then ( results => {
0 commit comments