From e364c0995d9ded4f2aa55c78713d4892965f7925 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Wed, 9 Jan 2013 17:53:48 -0800 Subject: [PATCH] Autocreate db/migrations --- cmd_create.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd_create.go b/cmd_create.go index a3cbcd1..c6619fd 100644 --- a/cmd_create.go +++ b/cmd_create.go @@ -3,6 +3,7 @@ package main import ( "fmt" "log" + "os" "path" "path/filepath" "text/template" @@ -37,6 +38,10 @@ func createRun(cmd *Command, args ...string) { timestamp := time.Now().Format("20060102150405") 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) var tmpl *template.Template