Go database schema migrator library (See cristalhq/dbumper tool).
Most of the tools related to database migrations are bloated with the questionable features and dependecies. However, in most of the cases migrations are just files with queries to run. This library does this.
- Simple.
- Clean and tested code.
- Supports
fs.FS
andgo:embed
. ZigZag
mode to better test migrations.- Dependency-free (database connectors are optional).
- Supported databases:
- Postgres
- MySQL
- ClickHouse
- or your own!
See GUIDE.md for more details.
Go version 1.17+
go get github.com/cristalhq/dbump
ctx := context.Background()
cfg := dbump.Config{
Migrator: dbump_pg.NewMigrator(db),
Loader: dbump.NewFileSysLoader(embed, "/"),
Mode: dbump.ModeApplyAll,
}
err := dbump.Run(ctx, cfg)
if err != nil {
panic(err)
}
Also see examples: example_test.go.
See these docs.