rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.23k stars 280 forks source link

programmatically rollback transactions #110

Closed MetalRex101 closed 6 years ago

MetalRex101 commented 6 years ago

Is there a way to programmatically (from code) rollback existing migrations?

rubenv commented 6 years ago

Yes, use Exec() (https://godoc.org/github.com/rubenv/sql-migrate#Exec) with a MigrationDirection of Down.

The command-line app uses the library, so just have a look at the code.