Fix new app creation bug #32

This commit is contained in:
Vikram Rangnekar
2020-01-14 23:16:55 -05:00
parent 3f5727c22b
commit d4dca86267
8 changed files with 23 additions and 16 deletions

View File

@ -33,7 +33,12 @@ func argMap(ctx context.Context, vars []byte) func(w io.Writer, tag string) (int
return 0, errors.New("query requires variable $user_role")
}
fmt.Println("1>", tag)
fmt.Println("2>", string(vars))
fields := jsn.Get(vars, [][]byte{[]byte(tag)})
fmt.Println("2.1>", fields)
if len(fields) == 0 {
return 0, nil
}
@ -42,6 +47,8 @@ func argMap(ctx context.Context, vars []byte) func(w io.Writer, tag string) (int
fields[0].Value = v[1 : len(v)-1]
}
fmt.Println("3>", string(fields[0].Value))
return w.Write(escQuote(fields[0].Value))
}
}

View File

@ -90,8 +90,8 @@ func cmdNew(cmd *cobra.Command, args []string) {
return os.Mkdir(p, os.ModePerm)
})
ifNotExists(path.Join(appMigrationsPath, "100_init.sql"), func(p string) error {
if v, err := tmpl.get("100_init.sql"); err == nil {
ifNotExists(path.Join(appMigrationsPath, "0_init.sql"), func(p string) error {
if v, err := tmpl.get("0_init.sql"); err == nil {
return ioutil.WriteFile(p, v, 0644)
} else {
return err