@@ -415,7 +415,7 @@ export class PostgresStorageAdapter {
415415 return toParseSchema ( schema )
416416 } )
417417 . catch ( ( err ) => {
418- if ( err . code === PostgresUniqueIndexViolationError && err . detail . includes ( className ) ) {
418+ if ( err . code === PostgresUniqueIndexViolationError && err . detail . indexOf ( className ) >= 0 ) {
419419 throw new Parse . Error ( Parse . Error . INVALID_CLASS_NAME , `Class ${ className } already exists.` )
420420 }
421421 throw err ;
@@ -445,7 +445,7 @@ export class PostgresStorageAdapter {
445445 relations . push ( fieldName )
446446 return ;
447447 }
448- if ( [ '_rperm' , '_wperm' ] . includes ( fieldName ) ) {
448+ if ( [ '_rperm' , '_wperm' ] . indexOf ( fieldName ) >= 0 ) {
449449 parseType . contents = { type : 'String' } ;
450450 }
451451 valuesArray . push ( fieldName ) ;
@@ -678,7 +678,7 @@ export class PostgresStorageAdapter {
678678 valuesArray . push ( object [ fieldName ] . objectId ) ;
679679 break ;
680680 case 'Array' :
681- if ( [ '_rperm' , '_wperm' ] . includes ( fieldName ) ) {
681+ if ( [ '_rperm' , '_wperm' ] . indexOf ( fieldName ) >= 0 ) {
682682 valuesArray . push ( object [ fieldName ] ) ;
683683 } else {
684684 valuesArray . push ( JSON . stringify ( object [ fieldName ] ) ) ;
@@ -707,7 +707,7 @@ export class PostgresStorageAdapter {
707707 let initialValues = valuesArray . map ( ( val , index ) => {
708708 let termination = '' ;
709709 let fieldName = columnsArray [ index ] ;
710- if ( [ '_rperm' , '_wperm' ] . includes ( fieldName ) ) {
710+ if ( [ '_rperm' , '_wperm' ] . indexOf ( fieldName ) >= 0 ) {
711711 termination = '::text[]' ;
712712 } else if ( schema . fields [ fieldName ] && schema . fields [ fieldName ] . type === 'Array' ) {
713713 termination = '::jsonb' ;
@@ -1031,9 +1031,9 @@ export class PostgresStorageAdapter {
10311031 const qs = `ALTER TABLE $1:name ADD CONSTRAINT $2:name UNIQUE (${ constraintPatterns . join ( ',' ) } )` ;
10321032 return this . _client . none ( qs , [ className , constraintName , ...fieldNames ] )
10331033 . catch ( error => {
1034- if ( error . code === PostgresDuplicateRelationError && error . message . includes ( constraintName ) ) {
1034+ if ( error . code === PostgresDuplicateRelationError && error . message . indexOf ( constraintName ) >= 0 ) {
10351035 // Index already exists. Ignore error.
1036- } else if ( error . code === PostgresUniqueIndexViolationError && error . message . includes ( constraintName ) ) {
1036+ } else if ( error . code === PostgresUniqueIndexViolationError && error . message . indexOf ( constraintName ) >= 0 ) {
10371037 // Cast the error into the proper parse error
10381038 throw new Parse . Error ( Parse . Error . DUPLICATE_VALUE , 'A duplicate value for a field with unique values was provided' ) ;
10391039 } else {
0 commit comments