mirror of
https://github.com/beego/bee.git
synced 2025-07-05 18:20:18 +00:00
add downsql & controller add mapping
This commit is contained in:
4
g.go
4
g.go
@ -158,10 +158,12 @@ func generateCode(cmd *Command, args []string) int {
|
||||
mname := args[1]
|
||||
ColorLog("[INFO] Using '%s' as migration name\n", mname)
|
||||
upsql := ""
|
||||
downsql := ""
|
||||
if fields != "" {
|
||||
upsql = `m.Sql("CREATE TABLE ` + mname + "(" + generateSQLFromFields(fields.String()) + `)");`
|
||||
downsql = `m.Sql("DROP TABLE ` + "`" + mname + "`" + `")`
|
||||
}
|
||||
generateMigration(mname, upsql, "", curpath)
|
||||
generateMigration(mname, upsql, downsql, curpath)
|
||||
case "controller":
|
||||
if len(args) == 2 {
|
||||
cname := args[1]
|
||||
|
Reference in New Issue
Block a user