From f196e2c93e7ecd12efb06c898665c94e4baeed63 Mon Sep 17 00:00:00 2001 From: Deng Ming Date: Thu, 28 Nov 2024 17:24:51 +0800 Subject: [PATCH] fix Beego issue 5719 --- cmd/commands/migrate/migrate.go | 3 ++- config/conf.go | 2 +- generate/g_scaffold.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/commands/migrate/migrate.go b/cmd/commands/migrate/migrate.go index 36073e1..2c0fe8b 100644 --- a/cmd/commands/migrate/migrate.go +++ b/cmd/commands/migrate/migrate.go @@ -4,7 +4,7 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT @@ -300,6 +300,7 @@ func writeMigrationSourceFile(dir, source, driver, connStr string, latestTime in // buildMigrationBinary changes directory to database/migrations folder and go-build the source func buildMigrationBinary(dir, binary string) { changeDir(dir) + _ = exec.Command("go", "mod", "tidy").Run() cmd := exec.Command("go", "build", "-o", binary) if out, err := cmd.CombinedOutput(); err != nil { beeLogger.Log.Errorf("Could not build migration binary: %s", err) diff --git a/config/conf.go b/config/conf.go index a6e0663..4ce320d 100644 --- a/config/conf.go +++ b/config/conf.go @@ -27,7 +27,7 @@ import ( const confVer = 0 const ( - Version = "2.1.0" + Version = "2.3.0" GitRemotePath = "github.com/beego/bee/v2" ) diff --git a/generate/g_scaffold.go b/generate/g_scaffold.go index 42ec8a2..34c9215 100644 --- a/generate/g_scaffold.go +++ b/generate/g_scaffold.go @@ -46,5 +46,5 @@ func GenerateScaffold(sname, fields, currpath, driver, conn string) { if utils.AskForConfirmation() { migrate.MigrateUpdate(currpath, driver, conn, "") } - beeLogger.Log.Successf("All done! Don't forget to add beego.Router(\"/%s\" ,&controllers.%sController{}) to routers/route.go\n", sname, strings.Title(sname)) + beeLogger.Log.Successf("All done! Don't forget to add beego.AutoPrefix(\"/%s\" ,&controllers.%sController{}) to routers/route.go\n", sname, strings.Title(sname)) }