Managing Database migrations in Go?

blov · · 1125 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi all,</p> <p>I was wondering if anyone had any recommendations (packages, etc) for managing DB migrations in a Go project. In particular, I&#39;m looking for something that can handle incremental changes.</p> <p>Thanks!</p> <hr/>**评论:**<br/><br/>oarmstrong: <pre><p>I still just use Flyway personally. Its not written in Go, but who cares, its just a tool.</p></pre>vhodges: <pre><p>And I am using <a href="https://bitbucket.org/liamstask/goose/">https://bitbucket.org/liamstask/goose/</a> (it&#39;s kind of railsish in the way it works). I ended up adding support for running the migrations to my program to simplify deployment.</p></pre>devfuturesw: <pre><p>Gorm is a ORM library that can handle incremental migrations. <a href="https://github.com/jinzhu/gorm">https://github.com/jinzhu/gorm</a> <a href="https://github.com/jinzhu/gorm#migration">https://github.com/jinzhu/gorm#migration</a></p></pre>postman_: <pre><p>I used <a href="https://github.com/mattes/migrate">https://github.com/mattes/migrate</a> . I like its non-intrusiveness.</p></pre>nerdyworm: <pre><p>I&#39;ve been using something akin to this: <a href="https://github.com/raintreeinc/knowledgebase/blob/master/kb/pgdb/version.go" rel="nofollow">https://github.com/raintreeinc/knowledgebase/blob/master/kb/pgdb/version.go</a> . 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.</p> <p>For something a bit more robust then I can recommend <a href="https://bitbucket.org/liamstask/goose/" rel="nofollow">https://bitbucket.org/liamstask/goose/</a></p></pre>_thwarted: <pre><p>I&#39;m using <a href="https://github.com/dwb/dogfish" rel="nofollow">https://github.com/dwb/dogfish</a> which isn&#39;t go specific, but does require bash, so it&#39;s not fully cross platform. Since it&#39;s external to the go code, it doesn&#39;t require building or running a binary in order to set up the database.</p></pre>br1and: <pre><p>I use a simple application that wraps <a href="https://github.com/DavidHuie/gomigrate" rel="nofollow">https://github.com/DavidHuie/gomigrate</a>. You can find it here: <a href="https://gist.github.com/bdittmer/573940d1e4d2842a68d1" rel="nofollow">https://gist.github.com/bdittmer/573940d1e4d2842a68d1</a></p></pre>kosokun: <pre><p>I use goose and I like it <a href="https://bitbucket.org/liamstask/goose/" rel="nofollow">https://bitbucket.org/liamstask/goose/</a></p></pre>c-dex: <pre><p>+1 for Goose</p></pre>

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

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