How do you handle migrations ?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • atlas

    Manage your database schema as code (by ariga)

  • You might want to check out Atlas. It provides automatic migration planning for GORM, and has various guides on how deploying schema migration on the popular platform and tools, such as Helm, Kubernetes and ECS.

  • migrate

    Database migrations. CLI and Golang library.

  • We use https://github.com/golang-migrate/migrate in an init-container, which (1) supports multiple durable storage technologies and (2) handles logical locking for the case where multiple migrations start concurrently.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • liquibase

    Main Liquibase Source

  • We use https://github.com/liquibase/liquibase, as most of Dev are used to and comfortable with it.

  • goose

    A database migration tool. Supports SQL migrations and Go functions.

  • Next try https://github.com/pressly/goose We have this setup to be run by the CI-CD pipeline to be run before the application is started. BTW, this utility is compatible with https://sqlc.dev , so they work good together.

  • sqlc

    Generate type-safe code from SQL

  • Next try https://github.com/pressly/goose We have this setup to be run by the CI-CD pipeline to be run before the application is started. BTW, this utility is compatible with https://sqlc.dev , so they work good together.

  • tern

    The SQL Fan's Migrator

  • We use https://github.com/jackc/tern library (from the author of the pgx driver). We run migrations in k8s init containers and we do not do rollbacks (only up). Advantages over other popular solutions are:

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts