go-pg-migrations alternatives and similar packages
Based on the "Database" category.
Alternatively, view go-pg-migrations alternatives based on common mentions on social networks and blogs.
prometheus10.0 9.8 go-pg-migrations VS prometheusThe Prometheus monitoring system and time series database.
influxdb9.9 9.4 go-pg-migrations VS influxdbScalable datastore for metrics, events, and real-time analytics
cockroach9.9 10.0 go-pg-migrations VS cockroachCockroachDB - the open source, cloud-native distributed SQL database.
tidb9.9 10.0 go-pg-migrations VS tidbTiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://tidbcloud.com/free-trial
jaeger9.8 8.9 go-pg-migrations VS jaegerCNCF Jaeger, a Distributed Tracing Platform
vitess9.8 9.9 go-pg-migrations VS vitessVitess is a database clustering system for horizontal scaling of MySQL.
Milvus9.8 9.9 go-pg-migrations VS MilvusA cloud-native vector database with high-performance and high scalability.
dgraph9.8 3.7 go-pg-migrations VS dgraphNative GraphQL Database with graph backend
bolt9.8 0.0 go-pg-migrations VS boltA low-level key/value database for Go.
badger9.7 8.0 go-pg-migrations VS badgerFast key-value DB in Go.
TinyGo9.7 9.1 go-pg-migrations VS TinyGoGo compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
dolt9.7 10.0 go-pg-migrations VS doltDolt – Git for Data
groupcache9.7 0.0 go-pg-migrations VS groupcachegroupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases.
rqlite9.7 8.1 go-pg-migrations VS rqliteThe lightweight, distributed relational database built on SQLite
migrate9.6 7.0 go-pg-migrations VS migrateDatabase migrations. CLI and Golang library.
noms9.5 1.9 go-pg-migrations VS nomsThe versioned, forkable, syncable database
kingshard9.5 0.0 go-pg-migrations VS kingshardA high-performance MySQL proxy
pgweb9.5 6.0 go-pg-migrations VS pgwebCross-platform client for PostgreSQL databases
Tile389.5 5.8 go-pg-migrations VS Tile38Real-time Geospatial and Geofencing
VictoriaMetricsVictoriaMetrics: fast, cost-effective monitoring solution and time series database
immudb9.4 9.5 go-pg-migrations VS immudbimmudb - immutable database based on zero trust, SQL and Key-Value, tamperproof, data change history
sqlc9.4 8.6 go-pg-migrations VS sqlcGenerate type-safe code from SQL
go-cache9.4 0.0 go-pg-migrations VS go-cacheAn in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.
bbolt9.3 0.0 go-pg-migrations VS bboltAn embedded key/value database for Go.
goleveldb9.3 6.4 go-pg-migrations VS goleveldbLevelDB key/value database in Go.
BigCache9.3 6.7 go-pg-migrations VS BigCacheEfficient cache for gigabytes of data written in Go.
dtm9.3 9.8 go-pg-migrations VS dtm此仓库应常青藤爸爸要求，已停止维护，请移步 https://github.com/dtm-labs/dtf
go-mysql9.2 7.3 go-pg-migrations VS go-mysqla powerful mysql toolset with Go
Squirrel9.2 1.7 go-pg-migrations VS SquirrelFluent SQL generation for golang
bytebase9.1 9.8 go-pg-migrations VS bytebaseDatabase CI/CD for DevOps teams. https://www.bytebase.com
go-mysql-elasticsearchSync MySQL data into elasticsearch
ledisdb9.0 0.0 go-pg-migrations VS ledisdbA high performance NoSQL Database Server powered by Go
buntdb9.0 3.1 go-pg-migrations VS buntdbBuntDB is an embeddable, in-memory key/value database for Go with custom indexing and geospatial support
pREST8.9 4.2 go-pg-migrations VS pRESTPostgreSQL ➕ REST, low-code, simplify and accelerate development, ⚡ instant, realtime, high-performance on any Postgres application, existing or new
rosedb8.9 9.1 go-pg-migrations VS rosedb🚀 A high performance NoSQL database based on bitcask, supports string, list, hash, set, and sorted set.
go-memdb8.8 0.0 go-pg-migrations VS go-memdbGolang in-memory database built on immutable radix trees
xo8.8 3.7 go-pg-migrations VS xoCommand line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server
dbmate8.7 3.5 go-pg-migrations VS dbmate:rocket: A lightweight, framework-agnostic database migration tool.
tiedot8.7 0.9 go-pg-migrations VS tiedotA rudimentary implementation of a basic document (NoSQL) database in Go
sql-migrate8.6 4.2 go-pg-migrations VS sql-migrateSQL schema migration tool for Go.
nutsdb8.6 8.6 go-pg-migrations VS nutsdbA simple, fast, embeddable, persistent key/value store written in pure Go. It supports fully serializable transactions and many data structures such as list, set, sorted set.
cache2go8.5 3.3 go-pg-migrations VS cache2goConcurrency-safe Go caching library with expiration capabilities and access counters
GCache8.5 0.0 go-pg-migrations VS GCacheAn in-memory cache library for golang. It supports multiple eviction policies: LRU, LFU, ARC
atlas8.4 0.0 go-pg-migrations VS atlasA modern tool for managing database schemas
fastcache8.1 1.6 go-pg-migrations VS fastcacheFast thread-safe inmemory cache for big number of entries in Go. Minimizes GC overhead
gocraft/dbr (database records)Additions to Go's database/sql for super fast performance and convenience.
goqu8.1 0.0 go-pg-migrations VS goquSQL builder and query library for golang
CovenantSQL8.0 0.0 go-pg-migrations VS CovenantSQLA decentralized, trusted, high performance, SQL database with blockchain features
gendry8.0 0.0 go-pg-migrations VS gendrya golang library for sql builder
chproxy7.8 7.6 go-pg-migrations VS chproxyOpen-Source ClickHouse http proxy and load balancer
Access the most powerful time series database as a service
Do you think we are missing an alternative of go-pg-migrations or a related project?
A Go package to help write migrations with
go-pg now has Go modules
go-pg-migrations also has
modules support; it currently depends on v10 of
go-pg. To install it, use the
following command in a project with a
$ go get github.com/robinjoseph08/go-pg-migrations/v3
If you are not yet using Go modules, you can still use v1 of this package.
To see how this package is intended to be used, you can look at the example
directory. All you need to do is have a
main package (e.g.
migrations.Run with the directory you want the migration
files to be saved in (which will be the same directory of the main package, e.g.
example), an instance of
os.Args; and log any potential errors
that could be returned.
Once this has been set up, then you can use the
help commands like so:
$ go run example/*.go create create_users_table Creating example/20180812001528_create_users_table.go... $ go run example/*.go migrate Running batch 1 with 1 migration(s)... Finished running "20180812001528_create_users_table" $ go run example/*.go rollback Rolling back batch 1 with 1 migration(s)... Finished rolling back "20180812001528_create_users_table" $ go run example/*.go help Usage: go run example/*.go [command] Commands: create - create a new migration in example with the provided name migrate - run any migrations that haven't been run yet rollback - roll back the previous run batch of migrations help - print this help text Examples: go run example/*.go create create_users_table go run example/*.go migrate go run example/*.go rollback go run example/*.go help
While this works when you have the Go toolchain installed, there might be a
scenario where you have to run migrations and you don't have the toolchain
available (e.g. in a
alpine Docker image deployed to production).
In that case, you should compile another binary (in addition to your actual
application) and copy it into the final image. This will include all of your
migrations and allow you to run it by overriding the command when running the
This would look something like this:
# Dockerfile FROM golang:1.13.3 as build WORKDIR /app COPY go.mod go.mod COPY go.sum go.sum RUN go mod download COPY . . RUN CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo -ldflags '-w -s' -o ./bin/serve ./cmd/serve RUN CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo -ldflags '-w -s' -o ./bin/migrations ./cmd/migrations FROM alpine:3.8 RUN apk --no-cache add ca-certificates COPY --from=build /app/bin /bin CMD ["serve"]
$ docker build -t service:latest . $ docker run --rm service:latest migrations migrate
While go-pg has its own
package, it leaves a bit to be desired.
Some additional features that this package supports:
- Complete migration diffing to determine which migrations still need to be run.
go-pg/migrationschecks the current version of migrations and runs any migrations after that, some migrations can be missed, especially when several people are working on the same project.
- Timestamp-based prefixes to prevent two people creating a migration with the same version on two separate branches. If the current version is 3, and more than one person branches off and creates a new migration, all of them will be version 4.
- The ability to run migrations in a transaction on a case-by-case basis. Most of the time, running migrations within a transaction is desirable, so that if it errs out within the "up" function, the whole migration is reverted. But since some long-running migrations might have a statement with a relatively exclusive lock, you might opt out of running that specific migration within a transaction.
- A migration locking mechanism. This is to avoid two people (or an automated deployment system) attempting to run migrations at the same time against the same database, which could lead to undesired behavior.
- An expected workflow of how this package should be used within a project.
go-pg/migrationshas some recommendations and examples, this package takes a more opinionated approach which makes it so you don't have to think about it as much, and there's less code for you to write and maintain.
- Batch-level rollbacks. When there are multiple migration files run during the same migration invocation, they are all grouped together into a "batch". During rollbacks, each batch gets rolled back together. This tends to be more desireable since this usually means the application is reverting back to a previous release, so the database should be in the state expected for that release.
Many of these features and expected behaviors come from using Knex.js migrations in production for many years. This project is heavily inspired by Knex to provide a robust and safe migration experience.
go-pg is a great and performant project, and hopefully, this makes it a little
To develop on this project, you'll need to have Postgres running because the tests depend on it.
If you have it running on your machine because it was installed through your
package manager (like
apt-get), you just need to run the following
to get it set up correctly:
If you don't have it on your laptop, you can run the following to start it within Docker:
That should start the container and keep it running while you develop. Once
you're done, you can
^C out of it and it will stop the container.
To run the tests, you should run:
To run the linter, you should run: