mirror of
https://github.com/pressly/goose.git
synced 2025-05-31 11:42:04 +00:00
Merge pull request #62 from tsctao/error-dir-not-exist
Add error if migration directory does not exist
This commit is contained in:
commit
02e9395c17
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
@ -105,6 +106,10 @@ func AddNamedMigration(filename string, up func(*sql.Tx) error, down func(*sql.T
|
||||
// CollectMigrations returns all the valid looking migration scripts in the
|
||||
// migrations folder and go func registry, and key them by version.
|
||||
func CollectMigrations(dirpath string, current, target int64) (Migrations, error) {
|
||||
if _, err := os.Stat(dirpath); os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("%s directory does not exists", dirpath)
|
||||
}
|
||||
|
||||
var migrations Migrations
|
||||
|
||||
// SQL migration files.
|
||||
|
Loading…
x
Reference in New Issue
Block a user