Hi all,
I was wondering if anyone had any recommendations (packages, etc) for managing DB migrations in a Go project. In particular, I'm looking for something that can handle incremental changes.
Thanks!
评论:
oarmstrong:
vhodges:I still just use Flyway personally. Its not written in Go, but who cares, its just a tool.
devfuturesw:And I am using https://bitbucket.org/liamstask/goose/ (it's kind of railsish in the way it works). I ended up adding support for running the migrations to my program to simplify deployment.
postman_:Gorm is a ORM library that can handle incremental migrations. https://github.com/jinzhu/gorm https://github.com/jinzhu/gorm#migration
nerdyworm:I used https://github.com/mattes/migrate . I like its non-intrusiveness.
_thwarted:I've been using something akin to this: https://github.com/raintreeinc/knowledgebase/blob/master/kb/pgdb/version.go . Basically a versions table and a bunch of sql statements. This works fine for most of my small projects. I like shipping a single binary, so having the migrations be part of the source is a win for me.
For something a bit more robust then I can recommend https://bitbucket.org/liamstask/goose/
br1and:I'm using https://github.com/dwb/dogfish which isn't go specific, but does require bash, so it's not fully cross platform. Since it's external to the go code, it doesn't require building or running a binary in order to set up the database.
kosokun:I use a simple application that wraps https://github.com/DavidHuie/gomigrate. You can find it here: https://gist.github.com/bdittmer/573940d1e4d2842a68d1
c-dex:I use goose and I like it https://bitbucket.org/liamstask/goose/
+1 for Goose
