@@ -945,7 +945,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
945
945
// Just create a table, do not insert in schema
946
946
async createTable ( className : string , schema : SchemaType , conn : any ) {
947
947
conn = conn || this . _client ;
948
- debug ( 'createTable' , className , schema ) ;
948
+ debug ( 'createTable' ) ;
949
949
const valuesArray = [ ] ;
950
950
const patternsArray = [ ] ;
951
951
const fields = Object . assign ( { } , schema . fields ) ;
@@ -983,7 +983,6 @@ export class PostgresStorageAdapter implements StorageAdapter {
983
983
const qs = `CREATE TABLE IF NOT EXISTS $1:name (${ patternsArray . join ( ) } )` ;
984
984
const values = [ className , ...valuesArray ] ;
985
985
986
- debug ( qs , values ) ;
987
986
return conn . task ( 'create-table' , async t => {
988
987
try {
989
988
await t . none ( qs , values ) ;
@@ -1007,7 +1006,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1007
1006
}
1008
1007
1009
1008
async schemaUpgrade ( className : string , schema : SchemaType , conn : any ) {
1010
- debug ( 'schemaUpgrade' , { className , schema } ) ;
1009
+ debug ( 'schemaUpgrade' ) ;
1011
1010
conn = conn || this . _client ;
1012
1011
const self = this ;
1013
1012
@@ -1029,7 +1028,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1029
1028
1030
1029
async addFieldIfNotExists ( className : string , fieldName : string , type : any , conn : any ) {
1031
1030
// TODO: Must be revised for invalid logic...
1032
- debug ( 'addFieldIfNotExists' , { className , fieldName , type } ) ;
1031
+ debug ( 'addFieldIfNotExists' ) ;
1033
1032
conn = conn || this . _client ;
1034
1033
const self = this ;
1035
1034
await conn . tx ( 'add-field-if-not-exists' , async t => {
@@ -1148,7 +1147,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1148
1147
1149
1148
// Returns a Promise.
1150
1149
async deleteFields ( className : string , schema : SchemaType , fieldNames : string [ ] ) : Promise < void > {
1151
- debug ( 'deleteFields' , className , fieldNames ) ;
1150
+ debug ( 'deleteFields' ) ;
1152
1151
fieldNames = fieldNames . reduce ( ( list : Array < string > , fieldName : string ) => {
1153
1152
const field = schema . fields [ fieldName ] ;
1154
1153
if ( field . type !== 'Relation' ) {
@@ -1191,7 +1190,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1191
1190
// this adapter doesn't know about the schema, return a promise that rejects with
1192
1191
// undefined as the reason.
1193
1192
async getClass ( className : string ) {
1194
- debug ( 'getClass' , className ) ;
1193
+ debug ( 'getClass' ) ;
1195
1194
return this . _client
1196
1195
. any ( 'SELECT * FROM "_SCHEMA" WHERE "className" = $<className>' , {
1197
1196
className,
@@ -1212,7 +1211,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1212
1211
object : any ,
1213
1212
transactionalSession : ?any
1214
1213
) {
1215
- debug ( 'createObject' , className , object ) ;
1214
+ debug ( 'createObject' ) ;
1216
1215
let columnsArray = [ ] ;
1217
1216
const valuesArray = [ ] ;
1218
1217
schema = toPostgresSchema ( schema ) ;
@@ -1333,7 +1332,6 @@ export class PostgresStorageAdapter implements StorageAdapter {
1333
1332
1334
1333
const qs = `INSERT INTO $1:name (${ columnsPattern } ) VALUES (${ valuesPattern } )` ;
1335
1334
const values = [ className , ...columnsArray , ...valuesArray ] ;
1336
- debug ( qs , values ) ;
1337
1335
const promise = ( transactionalSession ? transactionalSession . t : this . _client )
1338
1336
. none ( qs , values )
1339
1337
. then ( ( ) => ( { ops : [ object ] } ) )
@@ -1369,7 +1367,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1369
1367
query : QueryType ,
1370
1368
transactionalSession : ?any
1371
1369
) {
1372
- debug ( 'deleteObjectsByQuery' , className , query ) ;
1370
+ debug ( 'deleteObjectsByQuery' ) ;
1373
1371
const values = [ className ] ;
1374
1372
const index = 2 ;
1375
1373
const where = buildWhereClause ( {
@@ -1383,7 +1381,6 @@ export class PostgresStorageAdapter implements StorageAdapter {
1383
1381
where . pattern = 'TRUE' ;
1384
1382
}
1385
1383
const qs = `WITH deleted AS (DELETE FROM $1:name WHERE ${ where . pattern } RETURNING *) SELECT count(*) FROM deleted` ;
1386
- debug ( qs , values ) ;
1387
1384
const promise = ( transactionalSession ? transactionalSession . t : this . _client )
1388
1385
. one ( qs , values , a => + a . count )
1389
1386
. then ( count => {
@@ -1412,7 +1409,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1412
1409
update : any ,
1413
1410
transactionalSession : ?any
1414
1411
) : Promise < any > {
1415
- debug ( 'findOneAndUpdate' , className , query , update ) ;
1412
+ debug ( 'findOneAndUpdate' ) ;
1416
1413
return this . updateObjectsByQuery ( className , schema , query , update , transactionalSession ) . then (
1417
1414
val => val [ 0 ]
1418
1415
) ;
@@ -1426,7 +1423,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1426
1423
update : any ,
1427
1424
transactionalSession : ?any
1428
1425
) : Promise < [ any ] > {
1429
- debug ( 'updateObjectsByQuery' , className , query , update ) ;
1426
+ debug ( 'updateObjectsByQuery' ) ;
1430
1427
const updatePatterns = [ ] ;
1431
1428
const values = [ className ] ;
1432
1429
let index = 2 ;
@@ -1651,7 +1648,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1651
1648
index += 2 ;
1652
1649
}
1653
1650
} else {
1654
- debug ( 'Not supported update' , fieldName , fieldValue ) ;
1651
+ debug ( 'Not supported update' , { fieldName, fieldValue } ) ;
1655
1652
return Promise . reject (
1656
1653
new Parse . Error (
1657
1654
Parse . Error . OPERATION_FORBIDDEN ,
@@ -1671,7 +1668,6 @@ export class PostgresStorageAdapter implements StorageAdapter {
1671
1668
1672
1669
const whereClause = where . pattern . length > 0 ? `WHERE ${ where . pattern } ` : '' ;
1673
1670
const qs = `UPDATE $1:name SET ${ updatePatterns . join ( ) } ${ whereClause } RETURNING *` ;
1674
- debug ( 'update: ' , qs , values ) ;
1675
1671
const promise = ( transactionalSession ? transactionalSession . t : this . _client ) . any ( qs , values ) ;
1676
1672
if ( transactionalSession ) {
1677
1673
transactionalSession . batch . push ( promise ) ;
@@ -1687,7 +1683,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1687
1683
update : any ,
1688
1684
transactionalSession : ?any
1689
1685
) {
1690
- debug ( 'upsertOneObject' , { className , query , update } ) ;
1686
+ debug ( 'upsertOneObject' ) ;
1691
1687
const createValue = Object . assign ( { } , query , update ) ;
1692
1688
return this . createObject ( className , schema , createValue , transactionalSession ) . catch ( error => {
1693
1689
// ignore duplicate value errors as it's upsert
@@ -1704,14 +1700,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1704
1700
query : QueryType ,
1705
1701
{ skip, limit, sort, keys, caseInsensitive, explain } : QueryOptions
1706
1702
) {
1707
- debug ( 'find' , className , query , {
1708
- skip,
1709
- limit,
1710
- sort,
1711
- keys,
1712
- caseInsensitive,
1713
- explain,
1714
- } ) ;
1703
+ debug ( 'find' ) ;
1715
1704
const hasLimit = limit !== undefined ;
1716
1705
const hasSkip = skip !== undefined ;
1717
1706
let values = [ className ] ;
@@ -1778,7 +1767,6 @@ export class PostgresStorageAdapter implements StorageAdapter {
1778
1767
1779
1768
const originalQuery = `SELECT ${ columns } FROM $1:name ${ wherePattern } ${ sortPattern } ${ limitPattern } ${ skipPattern } ` ;
1780
1769
const qs = explain ? this . createExplainableQuery ( originalQuery ) : originalQuery ;
1781
- debug ( qs , values ) ;
1782
1770
return this . _client
1783
1771
. any ( qs , values )
1784
1772
. catch ( error => {
@@ -1926,7 +1914,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1926
1914
readPreference ?: string ,
1927
1915
estimate ?: boolean = true
1928
1916
) {
1929
- debug ( 'count' , className , query , readPreference , estimate ) ;
1917
+ debug ( 'count' ) ;
1930
1918
const values = [ className ] ;
1931
1919
const where = buildWhereClause ( {
1932
1920
schema,
@@ -1962,7 +1950,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
1962
1950
}
1963
1951
1964
1952
async distinct ( className : string , schema : SchemaType , query : QueryType , fieldName : string ) {
1965
- debug ( 'distinct' , className , query ) ;
1953
+ debug ( 'distinct' ) ;
1966
1954
let field = fieldName ;
1967
1955
let column = fieldName ;
1968
1956
const isNested = fieldName . indexOf ( '.' ) >= 0 ;
@@ -1989,7 +1977,6 @@ export class PostgresStorageAdapter implements StorageAdapter {
1989
1977
if ( isNested ) {
1990
1978
qs = `SELECT DISTINCT ${ transformer } ($1:raw) $2:raw FROM $3:name ${ wherePattern } ` ;
1991
1979
}
1992
- debug ( qs , values ) ;
1993
1980
return this . _client
1994
1981
. any ( qs , values )
1995
1982
. catch ( error => {
@@ -2028,7 +2015,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
2028
2015
hint : ?mixed ,
2029
2016
explain ? : boolean
2030
2017
) {
2031
- debug ( 'aggregate' , className , pipeline , readPreference , hint , explain ) ;
2018
+ debug ( 'aggregate' ) ;
2032
2019
const values = [ className ] ;
2033
2020
let index : number = 2 ;
2034
2021
let columns : string [ ] = [ ] ;
@@ -2209,7 +2196,6 @@ export class PostgresStorageAdapter implements StorageAdapter {
2209
2196
. filter ( Boolean )
2210
2197
. join ( ) } FROM $1 :name ${wherePattern } ${skipPattern } ${groupPattern } ${sortPattern } ${limitPattern } `;
2211
2198
const qs = explain ? this.createExplainableQuery(originalQuery) : originalQuery;
2212
- debug(qs, values);
2213
2199
return this._client.any(qs, values).then(a => {
2214
2200
if (explain) {
2215
2201
return a;
0 commit comments