Managing Database migrations in Go?

blov · 2016-01-26 17:50:44 · 1160 次点击    
这是一个分享于 2016-01-26 17:50:44 的资源,其中的信息可能已经有所发展或是发生改变。

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:

I still just use Flyway personally. Its not written in Go, but who cares, its just a tool.

vhodges:

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.

devfuturesw:

Gorm is a ORM library that can handle incremental migrations. https://github.com/jinzhu/gorm https://github.com/jinzhu/gorm#migration

postman_:

I used https://github.com/mattes/migrate . I like its non-intrusiveness.

nerdyworm:

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/

_thwarted:

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.

br1and:

I use a simple application that wraps https://github.com/DavidHuie/gomigrate. You can find it here: https://gist.github.com/bdittmer/573940d1e4d2842a68d1

kosokun:

I use goose and I like it https://bitbucket.org/liamstask/goose/

c-dex:

+1 for Goose


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1160 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传