mirror of https://github.com/pressly/goose.git
Autocreate db/migrations
parent
f89880da03
commit
e364c0995d
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
@ -37,6 +38,10 @@ func createRun(cmd *Command, args ...string) {
|
||||||
|
|
||||||
timestamp := time.Now().Format("20060102150405")
|
timestamp := time.Now().Format("20060102150405")
|
||||||
filename := fmt.Sprintf("%v_%v.%v", timestamp, args[0], migrationType)
|
filename := fmt.Sprintf("%v_%v.%v", timestamp, args[0], migrationType)
|
||||||
|
err = os.MkdirAll(conf.MigrationsDir, 0777)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
fpath := path.Join(conf.MigrationsDir, filename)
|
fpath := path.Join(conf.MigrationsDir, filename)
|
||||||
|
|
||||||
var tmpl *template.Template
|
var tmpl *template.Template
|
||||||
|
|
Loading…
Reference in New Issue