跳至正文
Wener Notes

migrate

约 1 分钟阅读
    • DB 迁移工具
    • 可当做库来使用
    • 支持较多的 Source 和 数据库
    • 不支持 ENV 和 配置文件 配置 DB - 只能 flag
bash
# macOS
curl -LO https://github.com/golang-migrate/migrate/releases/download/v4.18.3/migrate.darwin-amd64.tar.gz
tar zxvf migrate.darwin-amd64.tar.gz
migrate -v

brew install golang-migrate # macOS by brew

# 创建 sql 文件
# -seq 使用序列而非时间戳 - 000001
migrate create -ext sql -dir migrations -seq create_users_table

migrate -source file://,/migrations -database postgres://localhost:5432/database up 2

关联信息

反向链接、本文链接的其他页面和外部资料。

反向链接

  • Database Awesome
    笔记 · golang-migrate/migrate

    | name | stand for | · | Relational DBMS | 关系型数据库 | · | Key-value stores | KV 存储 | · | Document stores | 文档存储 | · | Time Series DBMS | 时序数据库 |

参考资料

GitHub1 条
最近更新commit 0892106编辑