rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.19k stars 275 forks source link

sql-migrate status fails if old migration file not found #37

Open dtelyukh opened 8 years ago

dtelyukh commented 8 years ago
  1. sql-migrate up
  2. remove sql-file
  3. sql-migrate status
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x10 pc=0x40b6be]

goroutine 1 [running]:
panic(0x8b2dc0, 0xc820010140)
        /usr/local/go/src/runtime/panic.go:481 +0x3e6
main.(*StatusCommand).Run(0xe65b08, 0xc82000a590, 0x0, 0x0, 0x9e0490)
        /home/d.telyukh/go/src/github.com/rubenv/sql-migrate/sql-migrate/command_status.go:86 +0x8be
github.com/mitchellh/cli.(*CLI).Run(0xc8203fa000, 0xc82001c450, 0x0, 0x0)
        /home/d.telyukh/go/src/github.com/mitchellh/cli/cli.go:154 +0x56e
main.realMain(0xc820000180)
        /home/d.telyukh/go/src/github.com/rubenv/sql-migrate/sql-migrate/main.go:39 +0x39e
main.main()
        /home/d.telyukh/go/src/github.com/rubenv/sql-migrate/sql-migrate/main.go:11 +0x18
dtelyukh commented 8 years ago

And sql-migrate up doesn't apply any new migrations when old files not found.