cli: generate migrations for mssql databases in hasura console mode

closes https://github.com/hasura/graphql-engine/issues/7011

https://github.com/hasura/graphql-engine-mono/pull/1527

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: c03af1b9c4221263a5e23a41bb710010fe82c018
This commit is contained in:
Kali Vara Purushotham Santhati 2021-06-15 11:59:45 +05:30 committed by hasura-bot
parent ad2f48c534
commit 0ce7769603
2 changed files with 4 additions and 3 deletions

View File

@ -13,6 +13,7 @@
- console: add modify functionality on columns, primary keys & unique keys to MS SQL Server tables
- cli: add interactive prompt to get input when `--database-name` flag is missing
- cli: fix metadata export to avoid unnecessary empty lines in actions.graphql (#5338)
- cli: generate migrations for mssql databases in hasura console mode (#7011)
## v2.0.0-beta.1

View File

@ -151,11 +151,11 @@ func MigrateAPI(c *gin.Context) {
return
}
createOptions := cmd.New(timestamp, request.Name, filepath.Join(ec.MigrationDir, sourceName))
if version != int(cli.V1) {
if version != int(cli.V1) && migrate.IsMigrationsSupported(sourceKind) {
sqlUp := &bytes.Buffer{}
sqlDown := &bytes.Buffer{}
for _, arg := range request.Up {
if arg.Type == hasuradb.RunSQL {
if strings.Contains(arg.Type, "run_sql") {
argByt, err := json.Marshal(arg.Args)
if err != nil {
c.JSON(http.StatusInternalServerError, &Response{Code: "request_parse_error", Message: err.Error()})
@ -173,7 +173,7 @@ func MigrateAPI(c *gin.Context) {
}
for _, arg := range request.Down {
if arg.Type == hasuradb.RunSQL {
if strings.Contains(arg.Type, "run_sql") {
argByt, err := json.Marshal(arg.Args)
if err != nil {
c.JSON(http.StatusInternalServerError, &Response{Code: "request_parse_error", Message: err.Error()})