@@ -237,7 +237,7 @@ const buildWhereClause = ({ schema, query, index }) => {
237
237
inPatterns . push ( `${ listElem } ` ) ;
238
238
}
239
239
} ) ;
240
- patterns . push ( `(${ name } )::jsonb @> '[${ inPatterns . join ( ',' ) } ]'::jsonb` ) ;
240
+ patterns . push ( `(${ name } )::jsonb @> '[${ inPatterns . join ( ) } ]'::jsonb` ) ;
241
241
} else if ( fieldValue . $regex ) {
242
242
// Handle later
243
243
} else {
@@ -320,9 +320,9 @@ const buildWhereClause = ({ schema, query, index }) => {
320
320
}
321
321
} ) ;
322
322
if ( allowNull ) {
323
- patterns . push ( `($${ index } :name IS NULL OR $${ index } :name && ARRAY[${ inPatterns . join ( ',' ) } ])` ) ;
323
+ patterns . push ( `($${ index } :name IS NULL OR $${ index } :name && ARRAY[${ inPatterns . join ( ) } ])` ) ;
324
324
} else {
325
- patterns . push ( `$${ index } :name && ARRAY[${ inPatterns . join ( ',' ) } ]` ) ;
325
+ patterns . push ( `$${ index } :name && ARRAY[${ inPatterns . join ( ) } ]` ) ;
326
326
}
327
327
index = index + 1 + inPatterns . length ;
328
328
} else if ( isInOrNin ) {
@@ -346,7 +346,7 @@ const buildWhereClause = ({ schema, query, index }) => {
346
346
inPatterns . push ( `$${ index + 1 + listIndex } ` ) ;
347
347
}
348
348
} ) ;
349
- patterns . push ( `$${ index } :name ${ not } IN (${ inPatterns . join ( ',' ) } )` ) ;
349
+ patterns . push ( `$${ index } :name ${ not } IN (${ inPatterns . join ( ) } )` ) ;
350
350
index = index + 1 + inPatterns . length ;
351
351
}
352
352
} else if ( ! notIn ) {
@@ -666,17 +666,15 @@ export class PostgresStorageAdapter {
666
666
const q1 = this . createTable ( className , schema , t ) ;
667
667
const q2 = t . none ( 'INSERT INTO "_SCHEMA" ("className", "schema", "isParseClass") VALUES ($<className>, $<schema>, true)' , { className, schema } ) ;
668
668
const q3 = this . setIndexesWithSchemaFormat ( className , schema . indexes , { } , schema . fields , t ) ;
669
-
670
669
return t . batch ( [ q1 , q2 , q3 ] ) ;
671
670
} )
672
671
. then ( ( ) => {
673
- return toParseSchema ( schema )
672
+ return toParseSchema ( schema ) ;
674
673
} )
675
- . catch ( ( err ) => {
676
- if ( Array . isArray ( err . data ) && err . data . length > 1 && err . data [ 0 ] . result . code === PostgresTransactionAbortedError ) {
674
+ . catch ( err => {
675
+ if ( err . data [ 0 ] . result . code === PostgresTransactionAbortedError ) {
677
676
err = err . data [ 1 ] . result ;
678
677
}
679
-
680
678
if ( err . code === PostgresUniqueIndexViolationError && err . detail . includes ( className ) ) {
681
679
throw new Parse . Error ( Parse . Error . DUPLICATE_VALUE , `Class ${ className } already exists.` )
682
680
}
@@ -723,7 +721,7 @@ export class PostgresStorageAdapter {
723
721
}
724
722
index = index + 2 ;
725
723
} ) ;
726
- const qs = `CREATE TABLE IF NOT EXISTS $1:name (${ patternsArray . join ( ',' ) } )` ;
724
+ const qs = `CREATE TABLE IF NOT EXISTS $1:name (${ patternsArray . join ( ) } )` ;
727
725
const values = [ className , ...valuesArray ] ;
728
726
729
727
return conn . task ( 'create-table' , function * ( t ) {
@@ -994,8 +992,8 @@ export class PostgresStorageAdapter {
994
992
return `POINT($${ l } , $${ l + 1 } )` ;
995
993
} ) ;
996
994
997
- const columnsPattern = columnsArray . map ( ( col , index ) => `$${ index + 2 } :name` ) . join ( ',' ) ;
998
- const valuesPattern = initialValues . concat ( geoPointsInjects ) . join ( ',' )
995
+ const columnsPattern = columnsArray . map ( ( col , index ) => `$${ index + 2 } :name` ) . join ( ) ;
996
+ const valuesPattern = initialValues . concat ( geoPointsInjects ) . join ( )
999
997
1000
998
const qs = `INSERT INTO $1:name (${ columnsPattern } ) VALUES (${ valuesPattern } )`
1001
999
const values = [ className , ...columnsArray , ...valuesArray ]
@@ -1233,7 +1231,7 @@ export class PostgresStorageAdapter {
1233
1231
values . push ( ...where . values ) ;
1234
1232
1235
1233
const whereClause = where . pattern . length > 0 ? `WHERE ${ where . pattern } ` : '' ;
1236
- const qs = `UPDATE $1:name SET ${ updatePatterns . join ( ',' ) } ${ whereClause } RETURNING *` ;
1234
+ const qs = `UPDATE $1:name SET ${ updatePatterns . join ( ) } ${ whereClause } RETURNING *` ;
1237
1235
debug ( 'update: ' , qs , values ) ;
1238
1236
return this . _client . any ( qs , values ) ;
1239
1237
}
@@ -1277,11 +1275,11 @@ export class PostgresStorageAdapter {
1277
1275
return `"${ key } " ASC` ;
1278
1276
}
1279
1277
return `"${ key } " DESC` ;
1280
- } ) . join ( ',' ) ;
1278
+ } ) . join ( ) ;
1281
1279
sortPattern = sort !== undefined && Object . keys ( sort ) . length > 0 ? `ORDER BY ${ sorting } ` : '' ;
1282
1280
}
1283
1281
if ( where . sorts && Object . keys ( where . sorts ) . length > 0 ) {
1284
- sortPattern = `ORDER BY ${ where . sorts . join ( ',' ) } ` ;
1282
+ sortPattern = `ORDER BY ${ where . sorts . join ( ) } ` ;
1285
1283
}
1286
1284
1287
1285
let columns = '*' ;
@@ -1295,7 +1293,7 @@ export class PostgresStorageAdapter {
1295
1293
return `ts_rank_cd(to_tsvector($${ 2 } , $${ 3 } :name), to_tsquery($${ 4 } , $${ 5 } ), 32) as score` ;
1296
1294
}
1297
1295
return `$${ index + values . length + 1 } :name` ;
1298
- } ) . join ( ',' ) ;
1296
+ } ) . join ( ) ;
1299
1297
values = values . concat ( keys ) ;
1300
1298
}
1301
1299
@@ -1398,7 +1396,7 @@ export class PostgresStorageAdapter {
1398
1396
// Will happily create the same index with multiple names.
1399
1397
const constraintName = `unique_${ fieldNames . sort ( ) . join ( '_' ) } ` ;
1400
1398
const constraintPatterns = fieldNames . map ( ( fieldName , index ) => `$${ index + 3 } :name` ) ;
1401
- const qs = `ALTER TABLE $1:name ADD CONSTRAINT $2:name UNIQUE (${ constraintPatterns . join ( ',' ) } )` ;
1399
+ const qs = `ALTER TABLE $1:name ADD CONSTRAINT $2:name UNIQUE (${ constraintPatterns . join ( ) } )` ;
1402
1400
return this . _client . none ( qs , [ className , constraintName , ...fieldNames ] )
1403
1401
. catch ( error => {
1404
1402
if ( error . code === PostgresDuplicateRelationError && error . message . includes ( constraintName ) ) {
@@ -1502,7 +1500,7 @@ export class PostgresStorageAdapter {
1502
1500
columns . push ( `AVG(${ transformAggregateField ( value . $avg ) } ) AS "${ field } "` ) ;
1503
1501
}
1504
1502
}
1505
- columns . join ( ',' ) ;
1503
+ columns . join ( ) ;
1506
1504
} else {
1507
1505
columns . push ( '*' ) ;
1508
1506
}
@@ -1543,7 +1541,7 @@ export class PostgresStorageAdapter {
1543
1541
return `"${ key } " ASC` ;
1544
1542
}
1545
1543
return `"${ key } " DESC` ;
1546
- } ) . join ( ',' ) ;
1544
+ } ) . join ( ) ;
1547
1545
sortPattern = sort !== undefined && Object . keys ( sort ) . length > 0 ? `ORDER BY ${ sorting } ` : '' ;
1548
1546
}
1549
1547
}
0 commit comments