1
0
mirror of https://github.com/beego/bee.git synced 2024-12-22 15:10:49 +00:00

change name of generated struct

This commit is contained in:
ZhengYang 2014-08-07 15:29:45 +08:00
parent af9780691c
commit cbe5fc1d21

View File

@ -45,7 +45,7 @@ func generateMigration(mname string, curpath string) {
fpath := path.Join(migrationFilePath, fmt.Sprintf("%s_%s.go", today, mname))
if f, err := os.OpenFile(fpath, os.O_CREATE|os.O_EXCL|os.O_RDWR, 0666); err == nil {
defer f.Close()
content := strings.Replace(MIGRATION_TPL, "{{StructName}}", camelCase(mname), -1)
content := strings.Replace(MIGRATION_TPL, "{{StructName}}", camelCase(mname)+"_"+today, -1)
content = strings.Replace(content, "{{CurrTime}}", today, -1)
f.WriteString(content)
// gofmt generated source code
@ -73,14 +73,16 @@ import (
"github.com/astaxie/beego/migration"
)
// DO NOT MODIFY
type {{StructName}} struct {
migration.Migration
}
// DO NOT MODIFY
func init() {
m := &{{StructName}}{}
m.Created = "{{CurrTime}}"
migration.Register(m)
migration.Register("{{StructName}}", m)
}
// Run the migrations