MCPcopy
hub / github.com/hasura/graphql-engine / SquashDeleteAPI

Function SquashDeleteAPI

cli/migrate/api/squash.go:85–113  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

83}
84
85func SquashDeleteAPI(c *gin.Context) {
86 sourcePtr, ok := c.Get("filedir")
87 if !ok {
88 return
89 }
90
91 sourceURL := sourcePtr.(*url.URL)
92
93 var request squashDeleteRequest
94 // Bind Request body to Request struct
95 if c.BindJSON(&request) != nil {
96 c.JSON(500, &Response{Code: "internal_error", Message: "Something went wrong"})
97 return
98 }
99
100 for _, v := range request.Versions {
101 delOptions := mig.CreateOptions{
102 Version: strconv.FormatInt(v, 10),
103 Directory: sourceURL.Path,
104 }
105 err := delOptions.Delete()
106 if err != nil {
107 c.JSON(500, &Response{Code: "internal_error", Message: "Something went wrong"})
108 return
109 }
110 }
111
112 c.JSON(http.StatusOK, gin.H{"message": "Migrations deleted"})
113}

Callers

nothing calls this directly

Calls 3

DeleteMethod · 0.95
JSONMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected