diff --git a/g.go b/g.go index 2d7e80e..e0eb265 100644 --- a/g.go +++ b/g.go @@ -166,8 +166,8 @@ func generateCode(cmd *Command, args []string) int { upsql := "" downsql := "" if fields != "" { - upsql = `m.Sql("CREATE TABLE ` + mname + "(" + generateSQLFromFields(fields.String()) + `)");` - downsql = `m.Sql("DROP TABLE ` + "`" + mname + "`" + `")` + upsql = `m.SQL("CREATE TABLE ` + mname + "(" + generateSQLFromFields(fields.String()) + `)");` + downsql = `m.SQL("DROP TABLE ` + "`" + mname + "`" + `")` } generateMigration(mname, upsql, downsql, curpath) case "controller": diff --git a/g_migration.go b/g_migration.go index 7e3fefe..d0d296d 100644 --- a/g_migration.go +++ b/g_migration.go @@ -79,13 +79,13 @@ func init() { // Run the migrations func (m *{{StructName}}) Up() { - // use m.Sql("CREATE TABLE ...") to make schema update + // use m.SQL("CREATE TABLE ...") to make schema update {{UpSQL}} } // Reverse the migrations func (m *{{StructName}}) Down() { - // use m.Sql("DROP TABLE ...") to reverse schema update + // use m.SQL("DROP TABLE ...") to reverse schema update {{DownSQL}} } ` diff --git a/g_scaffold.go b/g_scaffold.go index 1d0c239..e5617ba 100644 --- a/g_scaffold.go +++ b/g_scaffold.go @@ -28,8 +28,8 @@ func generateScaffold(sname, fields, crupath, driver, conn string) { upsql := "" downsql := "" if fields != "" { - upsql = `m.Sql("CREATE TABLE ` + sname + "(" + generateSQLFromFields(fields) + `)");` - downsql = `m.Sql("DROP TABLE ` + "`" + sname + "`" + `")` + upsql = `m.SQL("CREATE TABLE ` + sname + "(" + generateSQLFromFields(fields) + `)");` + downsql = `m.SQL("DROP TABLE ` + "`" + sname + "`" + `")` } generateMigration(sname, upsql, downsql, crupath) }