File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,12 +24,16 @@ type Session struct {
2424// @Failure 500 {object} map[string]interface{}
2525// @Router /database/pg_repack/recreate [put]
2626func RepackRecreateHandler (c * gin.Context ) {
27- if err := database .DB .Exec ("DROP EXTENSION IF EXISTS pg_repack CASCADE" ).Error ; err != nil {
28- c .JSON (http .StatusInternalServerError , gin.H {"err" : err .Error ()})
29- return
27+ runSequence := []string {
28+ "DROP EXTENSION IF EXISTS pg_repack CASCADE" ,
29+ "CREATE EXTENSION pg_repack" ,
30+ "GRANT USAGE ON SCHEMA repack TO vmaas_sync" ,
3031 }
31- if err := database .DB .Exec ("CREATE EXTENSION pg_repack" ).Error ; err != nil {
32- c .JSON (http .StatusInternalServerError , gin.H {"err" : err .Error ()})
32+ for _ , query := range runSequence {
33+ if err := database .DB .Exec (query ).Error ; err != nil {
34+ c .JSON (http .StatusInternalServerError , gin.H {"err" : err .Error ()})
35+ return
36+ }
3337 }
3438 c .JSON (http .StatusOK , "pg_repack extension re-created" )
3539}
You can’t perform that action at this time.
0 commit comments