@@ -643,9 +643,9 @@ module.exports = function(config, options) {
643
643
const { className } = args ;
644
644
let result ;
645
645
if ( className ) {
646
- result = await new Parse . Schema ( className ) . get ( ) ;
646
+ result = await new Parse . Schema ( className ) . get ( { useMasterKey : true } ) ;
647
647
} else {
648
- result = await Parse . Schema . all ( ) ;
648
+ result = await Parse . Schema . all ( { useMasterKey : true } ) ;
649
649
}
650
650
return result ;
651
651
}
@@ -728,7 +728,7 @@ module.exports = function(config, options) {
728
728
}
729
729
} ) ;
730
730
731
- const result = await schema . save ( ) ;
731
+ const result = await schema . save ( { useMasterKey : true } ) ;
732
732
733
733
const resultData = { success : true , className, schema : result } ;
734
734
return resultData ;
@@ -744,7 +744,7 @@ module.exports = function(config, options) {
744
744
745
745
// Check if the class exists first
746
746
try {
747
- await new Parse . Schema ( className ) . get ( ) ;
747
+ await new Parse . Schema ( className ) . get ( { useMasterKey : true } ) ;
748
748
} catch ( error ) {
749
749
if ( error . code === 103 ) {
750
750
throw new Error ( `Class "${ className } " does not exist.` ) ;
@@ -754,10 +754,19 @@ module.exports = function(config, options) {
754
754
755
755
// Delete the class and all its data
756
756
const schema = new Parse . Schema ( className ) ;
757
- await schema . purge ( ) ;
758
-
759
- const resultData = { success : true , className, message : `Class "${ className } " and all its data have been permanently deleted.` } ;
760
- return resultData ;
757
+
758
+ try {
759
+ // First purge all objects from the class
760
+ await schema . purge ( { useMasterKey : true } ) ;
761
+
762
+ // Then delete the class schema itself
763
+ await schema . delete ( { useMasterKey : true } ) ;
764
+
765
+ const resultData = { success : true , className, message : `Class "${ className } " and all its data have been permanently deleted.` } ;
766
+ return resultData ;
767
+ } catch ( deleteError ) {
768
+ throw new Error ( `Failed to delete class "${ className } ": ${ deleteError . message } ` ) ;
769
+ }
761
770
}
762
771
763
772
default :
0 commit comments