@@ -643,9 +643,9 @@ module.exports = function(config, options) {
643643 const { className } = args ;
644644 let result ;
645645 if ( className ) {
646- result = await new Parse . Schema ( className ) . get ( ) ;
646+ result = await new Parse . Schema ( className ) . get ( { useMasterKey : true } ) ;
647647 } else {
648- result = await Parse . Schema . all ( ) ;
648+ result = await Parse . Schema . all ( { useMasterKey : true } ) ;
649649 }
650650 return result ;
651651 }
@@ -728,7 +728,7 @@ module.exports = function(config, options) {
728728 }
729729 } ) ;
730730
731- const result = await schema . save ( ) ;
731+ const result = await schema . save ( { useMasterKey : true } ) ;
732732
733733 const resultData = { success : true , className, schema : result } ;
734734 return resultData ;
@@ -744,7 +744,7 @@ module.exports = function(config, options) {
744744
745745 // Check if the class exists first
746746 try {
747- await new Parse . Schema ( className ) . get ( ) ;
747+ await new Parse . Schema ( className ) . get ( { useMasterKey : true } ) ;
748748 } catch ( error ) {
749749 if ( error . code === 103 ) {
750750 throw new Error ( `Class "${ className } " does not exist.` ) ;
@@ -754,10 +754,19 @@ module.exports = function(config, options) {
754754
755755 // Delete the class and all its data
756756 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+ }
761770 }
762771
763772 default :
0 commit comments