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

Merge pull request #282 from oter/develop

Fix .exe postfix issue on Windows platform.
This commit is contained in:
astaxie 2016-09-16 10:47:51 +08:00 committed by GitHub
commit 8191997cbf

View File

@ -23,6 +23,7 @@ import (
"strconv"
"strings"
"time"
"runtime"
)
var cmdMigrate = &Command{
@ -145,8 +146,12 @@ func migrateRefresh(currpath, driver, connStr string) {
// migrate generates source code, build it, and invoke the binary who does the actual migration
func migrate(goal, currpath, driver, connStr string) {
dir := path.Join(currpath, "database", "migrations")
binary := "m"
dir := path.Join(currpath, "database", "migrations")
postfix := ""
if runtime.GOOS == "windows" {
postfix = ".exe"
}
binary := "m" + postfix
source := binary + ".go"
// connect to database
db, err := sql.Open(driver, connStr)