Description
This is a New Era of migrations PostgreSQL databases with Golang.
We no longer want to ensure the database schema with incremental patches.
Shema MUST match what the app wants! It doesn't matter what was in the database before that.
It could be empty, it could contain some data in any of its previous versions. It doesn't matter anymore. It is important that we carefully transform it into the target state. We will no longer be guessing about the target state of the database by patchset. This is a thing of the past.
This tool allows you to turn schemas into instructions for the database, including migrations between schemas. Create easy-to-read data models as contracts for agreement between architects, development teams, and team leaders. This tool provides agility to change the huge data-layered models.
goerd alternatives and similar packages
Based on the "Database" category.
Alternatively, view goerd alternatives based on common mentions on social networks and blogs.
-
Milvus
A cloud-native vector database, storage for next generation AI applications -
cockroach
CockroachDB - the open source, cloud-native distributed SQL database. -
tidb
TiDB 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 -
vitess
Vitess is a database clustering system for horizontal scaling of MySQL. -
TinyGo
Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM. -
groupcache
groupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases. -
VictoriaMetrics
VictoriaMetrics: fast, cost-effective monitoring solution and time series database -
bytebase
The GitLab/GitHub for database DevOps. World's most advanced database DevOps and CI/CD for Developer, DBA and Platform Engineering teams. -
go-cache
An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications. -
immudb
immudb - immutable database based on zero trust, SQL/Key-Value/Document model, tamperproof, data change history -
rosedb
Lightweight, fast and reliable key/value storage engine based on Bitcask. -
buntdb
BuntDB is an embeddable, in-memory key/value database for Go with custom indexing and geospatial support -
pREST
PostgreSQL ➕ REST, low-code, simplify and accelerate development, ⚡ instant, realtime, high-performance on any Postgres application, existing or new -
xo
Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server -
tiedot
A rudimentary implementation of a basic document (NoSQL) database in Go -
nutsdb
A 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. -
LinDB
LinDB is a scalable, high performance, high availability distributed time series database. -
cache2go
Concurrency-safe Go caching library with expiration capabilities and access counters -
GCache
An in-memory cache library for golang. It supports multiple eviction policies: LRU, LFU, ARC -
gocraft/dbr (database records)
Additions to Go's database/sql for super fast performance and convenience. -
lotusdb
Most advanced key-value store written in Go, extremely fast, compatible with LSM tree and B+ tree, optimization of badger and bbolt. -
fastcache
Fast thread-safe inmemory cache for big number of entries in Go. Minimizes GC overhead
WorkOS - The modern identity platform for B2B SaaS
Do you think we are missing an alternative of goerd or a related project?
Popular Comparisons
README
goerd
This is a New Era of migrations PostgreSQL databases with Golang.
We no longer want to ensure the database schema with incremental patches. Shema MUST match what the app wants! It doesn't matter what was in the database before that.
It could be empty, it could contain some data in any of its previous versions. It doesn't matter anymore. It is important that we carefully transform it into the target state. We will no longer be guessing about the target state of the database by patchset. This is a thing of the past.
This tool allows you to turn schemas into instructions for the database, including migrations between schemas. Create easy-to-read data models as contracts for agreement between architects, development teams, and team leaders. This tool provides agility to change the huge data-layered models.
[Conceptual view](concept.png)
Install
go install github.com/covrom/goerd/cmd/goerd@latest
Features
- Generate
yaml
short schema description from database - Generate plantuml view of schema
- Create posgresql migrations as a set of SQL queries that apply changes between two schemas, a schema and a database, or two databases using a schema definition that is stored in a yaml or plantuml file.
Migration of the following objects is currently supported:
- Tables
- Columns
- Indexes
- Constraints and Foreign Keys
- Views
This set covers 99% of PostgreSQL usecases in Golang services.
Example of generated plantuml:
[Plantuml view](plantuml-example.png)
Usage
Save database schema to yaml schema or PlantUML:
goerd -from "postgres://username:password@url:port/dbName" -to ./schema1.yaml
goerd -from "postgres://username:password@url:port/dbName" -to ./schema1.puml
Print SQL queries migration between two schemas, dropping queries is commented out:
goerd -from schema1.yml -to schema2.yaml
goerd -from schema1.yml -to "postgres://username:password@url:port/dbName"
With dropping queries:
goerd -drop -from schema1.yml -to schema2.yml
goerd -drop -from schema1.yml -to "postgres://username:password@url:port/dbName"
Save PlantUML from schema:
goerd -from schema1.yml -to schema1.puml
goerd -from "postgres://username:password@url:port/dbName" -to schema1.puml
Apply schema from yaml to database:
goerd -c apply -from schema1.yml -to "postgres://username:password@url:port/dbName"
Apply schema from DB1 to DB2:
goerd -c apply -from "postgres://username:password@url:port/DB1" -to "postgres://username:password@url:port/DB2"
API
See docs.
testing and examples
docker-compose up
and see ./output/schema.yaml