We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 415da4f commit b02ee18Copy full SHA for b02ee18
migration/migration.go
@@ -32,6 +32,9 @@ func NewMigration(dir string, id string) Migration {
32
b, _ := ioutil.ReadFile(dir + "/" + id + ".sql")
33
r := regexp.MustCompile(`(?m)-- \+migrate Up\n([\s\S]*)\n-- \+migrate Down\n([\s\S]*)`)
34
sqls := r.FindSubmatch(b)
35
+ if len(sqls) == 0 {
36
+ log.Fatalf("Invalid file format: %s\n", id)
37
+ }
38
up := splitSQL(string(sqls[1]))
39
down := splitSQL(string(sqls[2]))
40
return Migration{ID: id, Up: up, Down: down}
0 commit comments