mirror of
https://github.com/beego/bee.git
synced 2024-11-22 10:10:53 +00:00
Merge pull request #140 from WnP/beego-dev-changes
update migration.Sql to migration.SQL to match beego develop
This commit is contained in:
commit
7813d6aab0
4
g.go
4
g.go
@ -166,8 +166,8 @@ func generateCode(cmd *Command, args []string) int {
|
|||||||
upsql := ""
|
upsql := ""
|
||||||
downsql := ""
|
downsql := ""
|
||||||
if fields != "" {
|
if fields != "" {
|
||||||
upsql = `m.Sql("CREATE TABLE ` + mname + "(" + generateSQLFromFields(fields.String()) + `)");`
|
upsql = `m.SQL("CREATE TABLE ` + mname + "(" + generateSQLFromFields(fields.String()) + `)");`
|
||||||
downsql = `m.Sql("DROP TABLE ` + "`" + mname + "`" + `")`
|
downsql = `m.SQL("DROP TABLE ` + "`" + mname + "`" + `")`
|
||||||
}
|
}
|
||||||
generateMigration(mname, upsql, downsql, curpath)
|
generateMigration(mname, upsql, downsql, curpath)
|
||||||
case "controller":
|
case "controller":
|
||||||
|
@ -79,13 +79,13 @@ func init() {
|
|||||||
|
|
||||||
// Run the migrations
|
// Run the migrations
|
||||||
func (m *{{StructName}}) Up() {
|
func (m *{{StructName}}) Up() {
|
||||||
// use m.Sql("CREATE TABLE ...") to make schema update
|
// use m.SQL("CREATE TABLE ...") to make schema update
|
||||||
{{UpSQL}}
|
{{UpSQL}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse the migrations
|
// Reverse the migrations
|
||||||
func (m *{{StructName}}) Down() {
|
func (m *{{StructName}}) Down() {
|
||||||
// use m.Sql("DROP TABLE ...") to reverse schema update
|
// use m.SQL("DROP TABLE ...") to reverse schema update
|
||||||
{{DownSQL}}
|
{{DownSQL}}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
@ -28,8 +28,8 @@ func generateScaffold(sname, fields, crupath, driver, conn string) {
|
|||||||
upsql := ""
|
upsql := ""
|
||||||
downsql := ""
|
downsql := ""
|
||||||
if fields != "" {
|
if fields != "" {
|
||||||
upsql = `m.Sql("CREATE TABLE ` + sname + "(" + generateSQLFromFields(fields) + `)");`
|
upsql = `m.SQL("CREATE TABLE ` + sname + "(" + generateSQLFromFields(fields) + `)");`
|
||||||
downsql = `m.Sql("DROP TABLE ` + "`" + sname + "`" + `")`
|
downsql = `m.SQL("DROP TABLE ` + "`" + sname + "`" + `")`
|
||||||
}
|
}
|
||||||
generateMigration(sname, upsql, downsql, crupath)
|
generateMigration(sname, upsql, downsql, crupath)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user