SQL schema migration tool for Go.

Overview

sql-migrate

SQL Schema migration tool for Go. Based on gorp and goose.

Build Status GoDoc

Using modl? Check out modl-migrate.

Features

  • Usable as a CLI tool or as a library
  • Supports SQLite, PostgreSQL, MySQL, MSSQL and Oracle databases (through gorp)
  • Can embed migrations into your application
  • Migrations are defined with SQL for full flexibility
  • Atomic migrations
  • Up/down migrations to allow rollback
  • Supports multiple database types in one project
  • Works great with other libraries such as sqlx

Installation

To install the library and command line program, use the following:

go get -v github.com/rubenv/sql-migrate/...

Usage

As a standalone tool

$ sql-migrate --help
usage: sql-migrate [--version] [--help] <command> [<args>]

Available commands are:
    down      Undo a database migration
    new       Create a new migration
    redo      Reapply the last migration
    status    Show migration status
    up        Migrates the database to the most recent version available

Each command requires a configuration file (which defaults to dbconfig.yml, but can be specified with the -config flag). This config file should specify one or more environments:

development:
    dialect: sqlite3
    datasource: test.db
    dir: migrations/sqlite3

production:
    dialect: postgres
    datasource: dbname=myapp sslmode=disable
    dir: migrations/postgres
    table: migrations

(See more examples for different set ups here)

Also one can obtain env variables in datasource field via os.ExpandEnv embedded call for the field. This may be useful if one doesn't want to store credentials in file:

production:
    dialect: postgres
    datasource: host=prodhost dbname=proddb user=${DB_USER} password=${DB_PASSWORD} sslmode=required
    dir: migrations
    table: migrations

The table setting is optional and will default to gorp_migrations.

The environment that will be used can be specified with the -env flag (defaults to development).

Use the --help flag in combination with any of the commands to get an overview of its usage:

$ sql-migrate up --help
Usage: sql-migrate up [options] ...

  Migrates the database to the most recent version available.

Options:

  -config=dbconfig.yml   Configuration file to use.
  -env="development"     Environment.
  -limit=0               Limit the number of migrations (0 = unlimited).
  -dryrun                Don't apply migrations, just print them.

The new command creates a new empty migration template using the following pattern <current time>-<name>.sql.

The up command applies all available migrations. By contrast, down will only apply one migration by default. This behavior can be changed for both by using the -limit parameter.

The redo command will unapply the last migration and reapply it. This is useful during development, when you're writing migrations.

Use the status command to see the state of the applied migrations:

$ sql-migrate status
+---------------+-----------------------------------------+
|   MIGRATION   |                 APPLIED                 |
+---------------+-----------------------------------------+
| 1_initial.sql | 2014-09-13 08:19:06.788354925 +0000 UTC |
| 2_record.sql  | no                                      |
+---------------+-----------------------------------------+

Running Test Integrations

You can see how to run setups for different setups by executing the .sh files in test-integration

# Run mysql-env.sh example (you need to be in the project root directory)

./test-integration/mysql-env.sh

MySQL Caveat

If you are using MySQL, you must append ?parseTime=true to the datasource configuration. For example:

production:
    dialect: mysql
    datasource: [email protected]/dbname?parseTime=true
    dir: migrations/mysql
    table: migrations

See here for more information.

Oracle (oci8)

Oracle Driver is oci8, it is not pure Go code and relies on Oracle Office Client (Instant Client), more detailed information is in the oci8 repo.

Install with Oracle support

To install the library and command line program, use the following:

go get -tags oracle -v github.com/rubenv/sql-migrate/...
development:
    dialect: oci8
    datasource: user/[email protected]:1521/sid
    dir: migrations/oracle
    table: migrations

Oracle (godror)

Oracle Driver is godror, it is not pure Go code and relies on Oracle Office Client (Instant Client), more detailed information is in the godror repository.

Install with Oracle support

To install the library and command line program, use the following:

  1. Install sql-migrate
go get -tags godror -v github.com/rubenv/sql-migrate/...
  1. Download Oracle Office Client(e.g. macos, click Instant Client if you are other system)
wget https://download.oracle.com/otn_software/mac/instantclient/193000/instantclient-basic-macos.x64-19.3.0.0.0dbru.zip
  1. Configure environment variables LD_LIBRARY_PATH
export LD_LIBRARY_PATH=your_oracle_office_path/instantclient_19_3
development:
    dialect: godror
    datasource: user/[email protected]:1521/sid
    dir: migrations/oracle
    table: migrations

As a library

Import sql-migrate into your application:

import "github.com/rubenv/sql-migrate"

Set up a source of migrations, this can be from memory, from a set of files, from bindata (more on that later), or from any library that implements http.FileSystem:

// Hardcoded strings in memory:
migrations := &migrate.MemoryMigrationSource{
    Migrations: []*migrate.Migration{
        &migrate.Migration{
            Id:   "123",
            Up:   []string{"CREATE TABLE people (id int)"},
            Down: []string{"DROP TABLE people"},
        },
    },
}

// OR: Read migrations from a folder:
migrations := &migrate.FileMigrationSource{
    Dir: "db/migrations",
}

// OR: Use migrations from a packr box
migrations := &migrate.PackrMigrationSource{
    Box: packr.New("migrations", "./migrations"),
}

// OR: Use pkger which implements `http.FileSystem`
migrationSource := &migrate.HttpFileSystemMigrationSource{
    FileSystem: pkger.Dir("/db/migrations"),
}

// OR: Use migrations from bindata:
migrations := &migrate.AssetMigrationSource{
    Asset:    Asset,
    AssetDir: AssetDir,
    Dir:      "migrations",
}

// OR: Read migrations from a `http.FileSystem`
migrationSource := &migrate.HttpFileSystemMigrationSource{
    FileSystem: httpFS,
}

Then use the Exec function to upgrade your database:

db, err := sql.Open("sqlite3", filename)
if err != nil {
    // Handle errors!
}

n, err := migrate.Exec(db, "sqlite3", migrations, migrate.Up)
if err != nil {
    // Handle errors!
}
fmt.Printf("Applied %d migrations!\n", n)

Note that n can be greater than 0 even if there is an error: any migration that succeeded will remain applied even if a later one fails.

Check the GoDoc reference for the full documentation.

Writing migrations

Migrations are defined in SQL files, which contain a set of SQL statements. Special comments are used to distinguish up and down migrations.

-- +migrate Up
-- SQL in section 'Up' is executed when this migration is applied
CREATE TABLE people (id int);


-- +migrate Down
-- SQL section 'Down' is executed when this migration is rolled back
DROP TABLE people;

You can put multiple statements in each block, as long as you end them with a semicolon (;).

You can alternatively set up a separator string that matches an entire line by setting sqlparse.LineSeparator. This can be used to imitate, for example, MS SQL Query Analyzer functionality where commands can be separated by a line with contents of GO. If sqlparse.LineSeparator is matched, it will not be included in the resulting migration scripts.

If you have complex statements which contain semicolons, use StatementBegin and StatementEnd to indicate boundaries:

-- +migrate Up
CREATE TABLE people (id int);

-- +migrate StatementBegin
CREATE OR REPLACE FUNCTION do_something()
returns void AS $$
DECLARE
  create_query text;
BEGIN
  -- Do something here
END;
$$
language plpgsql;
-- +migrate StatementEnd

-- +migrate Down
DROP FUNCTION do_something();
DROP TABLE people;

The order in which migrations are applied is defined through the filename: sql-migrate will sort migrations based on their name. It's recommended to use an increasing version number or a timestamp as the first part of the filename.

Normally each migration is run within a transaction in order to guarantee that it is fully atomic. However some SQL commands (for example creating an index concurrently in PostgreSQL) cannot be executed inside a transaction. In order to execute such a command in a migration, the migration can be run using the notransaction option:

-- +migrate Up notransaction
CREATE UNIQUE INDEX people_unique_id_idx CONCURRENTLY ON people (id);

-- +migrate Down
DROP INDEX people_unique_id_idx;

Embedding migrations with packr

If you like your Go applications self-contained (that is: a single binary): use packr to embed the migration files.

Just write your migration files as usual, as a set of SQL files in a folder.

Import the packr package into your application:

import "github.com/gobuffalo/packr/v2"

Use the PackrMigrationSource in your application to find the migrations:

migrations := &migrate.PackrMigrationSource{
    Box: packr.New("migrations", "./migrations"),
}

If you already have a box and would like to use a subdirectory:

migrations := &migrate.PackrMigrationSource{
    Box: myBox,
    Dir: "./migrations",
}

Embedding migrations with bindata

As an alternative, but slightly less maintained, you can use bindata to embed the migration files.

Just write your migration files as usual, as a set of SQL files in a folder.

Then use bindata to generate a .go file with the migrations embedded:

go-bindata -pkg myapp -o bindata.go db/migrations/

The resulting bindata.go file will contain your migrations. Remember to regenerate your bindata.go file whenever you add/modify a migration (go generate will help here, once it arrives).

Use the AssetMigrationSource in your application to find the migrations:

migrations := &migrate.AssetMigrationSource{
    Asset:    Asset,
    AssetDir: AssetDir,
    Dir:      "db/migrations",
}

Both Asset and AssetDir are functions provided by bindata.

Then proceed as usual.

Embedding migrations with libraries that implement http.FileSystem

You can also embed migrations with any library that implements http.FileSystem, like vfsgen, parcello, or go-resources.

migrationSource := &migrate.HttpFileSystemMigrationSource{
    FileSystem: httpFS,
}

Extending

Adding a new migration source means implementing MigrationSource.

type MigrationSource interface {
    FindMigrations() ([]*Migration, error)
}

The resulting slice of migrations will be executed in the given order, so it should usually be sorted by the Id field.

Usage with sqlx

This library is compatible with sqlx. When calling migrate just dereference the DB from your *sqlx.DB:

n, err := migrate.Exec(db.DB, "sqlite3", migrations, migrate.Up)
                    //   ^^^ <-- Here db is a *sqlx.DB, the db.DB field is the plain sql.DB
if err != nil {
    // Handle errors!
}

License

This library is distributed under the MIT license.

Issues
  • Add go1.16 embed

    Add go1.16 embed

    ~~Not intended for merge but more as a discussion starter.~~ All done with backwards compat!

    Since all the sources are in that big migrate.go I wasn't sure how to go about this but the new source could be pulled into a separate file with a // +build so that the rest of the code still works on previous versions.

    Adding a root directory to findMigrations() was necessary because dir.Open("/") just returns a NotFound error and thus migrationFromFile() also had to change a little.

    opened by cryptix 19
  • Cannot go get from a fresh machine

    Cannot go get from a fresh machine

    This is a machine which has no golang code on it, like a fresh install

    OUTPUT

    [email protected]:~$ go get -v github.com/rubenv/sql-migrate/...
    github.com/rubenv/sql-migrate (download)
    get "gopkg.in/gorp.v1": found meta tag get.metaImport{Prefix:"gopkg.in/gorp.v1", VCS:"git", RepoRoot:"https://gopkg.in/gorp.v1"} at //gopkg.in/gorp.v1?go-get=1
    gopkg.in/gorp.v1 (download)
    github.com/denisenkom/go-mssqldb (download)
    github.com/golang-sql/civil (download)
    get "golang.org/x/crypto/md4": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at //golang.org/x/crypto/md4?go-get=1
    get "golang.org/x/crypto/md4": verifying non-authoritative meta tag
    golang.org/x/crypto (download)
    github.com/go-sql-driver/mysql (download)
    github.com/lib/pq (download)
    github.com/mattn/go-sqlite3 (download)
    github.com/mitchellh/cli (download)
    github.com/armon/go-radix (download)
    github.com/bgentry/speakeasy (download)
    github.com/fatih/color (download)
    github.com/mattn/go-isatty (download)
    github.com/posener/complete (download)
    github.com/hashicorp/go-multierror (download)
    github.com/hashicorp/errwrap (download)
    package github.com/rubenv/sql-migrate/sql-migrate
    	imports github.com/posener/complete/cmd/install: cannot find package "github.com/posener/complete/cmd/install" in any of:
    	/usr/local/Cellar/go/1.13.4/libexec/src/github.com/posener/complete/cmd/install (from $GOROOT)
    	/Users/mau/go/src/github.com/posener/complete/cmd/install (from $GOPATH)
    github.com/olekukonko/tablewriter (download)
    github.com/mattn/go-runewidth (download)
    get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at //gopkg.in/yaml.v2?go-get=1
    

    ENVIRONMENT

    [email protected]:~$ go env
    GO111MODULE=""
    GOARCH="amd64"
    GOBIN=""
    GOCACHE="/Users/mau/Library/Caches/go-build"
    GOENV="/Users/mau/Library/Application Support/go/env"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GONOPROXY=""
    GONOSUMDB=""
    GOOS="darwin"
    GOPATH="/Users/mau/go"
    GOPRIVATE=""
    GOPROXY="https://proxy.golang.org,direct"
    GOROOT="/usr/local/Cellar/go/1.13.4/libexec"
    GOSUMDB="sum.golang.org"
    GOTMPDIR=""
    GOTOOLDIR="/usr/local/Cellar/go/1.13.4/libexec/pkg/tool/darwin_amd64"
    GCCGO="gccgo"
    AR="ar"
    CC="clang"
    CXX="clang++"
    CGO_ENABLED="1"
    GOMOD=""
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/82/3klc7kss6wgfrx9t54sdd8zw0000gn/T/go-build159606206=/tmp/go-build -gno-record-gcc-switches -fno-common"
    
    opened by mauleyzaola 18
  • Add ability to skip unknown migrations in database

    Add ability to skip unknown migrations in database

    I know this seems like a very strange request. But as it isn't a backwards breaking and I may not be the only one, I figure why not open a PR.

    Scenario:

    In a microservice type situation where each service maintains its own schema (yes only schema, not DB), there is a case where this pops up.

    In Postgres, I have a public schema in each DB and a service_name schema that is owned by a particular service. Multiple services can share the same DB. That way a service can read (not write) to other services data. But all the services in the same DB will use the same public schema.

    If service A has newer migrations for the public schema and I want to deploy a version of service B that doesn't have the new migrations, if service A is applied first then service B, Service B would complain that there is a migration in the database that is not in the known migration source.

    I am consuming sql-migrate as a package and will be writing my own MigrationSource as we have a pretty specific structure to follow (many microservices in a single mono repository). This is the only that has me stuck. I would really appreciate not having to maintain my own migrator (a fork of this), but completely understand if this is too much of an edge case to merge in and maintain.

    opened by dixonwille 13
  • Tag v1.0.0?

    Tag v1.0.0?

    I know this issue has been brought up before, but I think it's worth reiterating. Adding a v1.0.0 tag to this project would give a strong signal of stability and maturity to this library. Users would also be able to opt-in to updates more clearly moving forward. GitHub now lets users subscribe to new releases on projects etc. and then changing from v1.0.0 to v1.1.0 etc. would be nice and simple.

    My go.mod file currently has this line which is not ideal, because according to semver there are no backwards compatibility promises before v1.0.0, the next version of sql-migrate could completely break my application.

    github.com/rubenv/sql-migrate v0.0.0-20191116071645-ce2300be8dc8
    
    opened by wayneashleyberry 12
  • Note 1050: Table 'gorp_migrations' already exists

    Note 1050: Table 'gorp_migrations' already exists

    I have a program that attempts to apply any migrations it has not applied run after connecting to the database. However, when I run my program I get:

    Note 1050: Table 'gorp_migrations' already exists
    

    The migrations are stored using bindata. Here is the function definition:

    // Open returns a DB reference for a data source.
    func Open(dataSourceName string) (*DB, error) {
        db, err := sql.Open("mysql", dataSourceName)
    
        if err != nil {
            return nil, err
        }
    
        db.Ping()
        if err != nil {
            return nil, err
        }
    
        migrations := &migrate.AssetMigrationSource{
            Asset:    Asset,
            AssetDir: AssetDir,
            Dir:      "migrations",
        }
    
        n, err := migrate.Exec(db, "mysql", migrations, migrate.Up)
        if err != nil {
            return nil, err
        }
        fmt.Printf("Applied %d migrations!\n", n)
    
        return &DB{db}, nil
    }
    

    Any pointers on what I'm doing wrong? It looks like the call to CreateTablesIfNotExists() isn't working correctly; it appears to be returning an error and returning.

    opened by JalfResi 9
  • Set migration table using an environment variable.

    Set migration table using an environment variable.

    Example usage:

    MIGRATION_TABLE=bunnies sql-migrate up

    Or:

    export MIGRATION_TABLE=bunnies sql-migrate up


    Notes: This is for discussion purposes. I haven't yet added any documentation. It was more difficult than expected to add a command-line flag without adding duplicate code to several files, so I avoided that for now.

    If this approach is accepted then I'll add documentation before expecting this pull request to be accepted. In the meantime, it's a fix for @ciarand which does not break compatibility.

    enhancement 
    opened by ShawnMilo 9
  • Slurp errors to keep errcheck happy

    Slurp errors to keep errcheck happy

    Not sure if upstream is using errcheck, so likely will not publish this change to them, unless they are welcome to it. Publishing as its own PR to keep that bookkeeping separate.

    There is nothing really to do with these errors.

    • There are no loggers in the top-level library code, and this is already in the rollback error control flow, so there is no erroring to signal (we already are).
    • The failure to print to stderr in the main sql-migrate doesn't seem to have any sane recourse.
    • We could consider a message in the failure to close the file descriptor, but this logic is going to be moved up to the library, which still doesn't have a logger, and this is already when we are going through the error path, so there is no error to return.
    opened by quintenpalmer 8
  • Panic when using dialect: mysql

    Panic when using dialect: mysql

    With dialect: mysql I get the following when running sql-migrate up:

    panic: gorp - undefined MySQLDialect.Engine, MySQLDialect.Encoding. Check that your MySQLDialect was correctly initialized when declared.
    

    Looking at the source, the engine and encoding need to be set somehow. Am I missing some option?

    opened by lluchs 8
  • How to write 001.sql for existing environments?

    How to write 001.sql for existing environments?

    Hi all,

    Is there a best practice for the post-fit of this system for existing environments? For example, initial state will be taken from our prod env. So the 001 script will recreate the entire schema for qa, stage etc, but ideally it would not be run on prod (as the schema would already be correct).

    I suspect the answer would be in a different script for each env, but this means maintaining a script for every env, I would prefer to have a single set for all envs.

    Any suggestions would be welcome.

    opened by stephen-kruger 7
  • support to turn off transactions per migration

    support to turn off transactions per migration

    There are SQL Queries that can't run inside a transaction. Since all Migrations run inside a transaction there is no way to run these queries within a migration. (Eg. creating concurrent indices with postgres http://www.postgresql.org/docs/9.3/static/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY)

    Maybe by adding a -- +migrate DisableTransaction or a -- +migrate DisableTx comment.

    help wanted 
    opened by dre1080 7
  • Support native golang embed.FS

    Support native golang embed.FS

    Is your feature request related to a problem? Please describe.

    Since version 1.16 golang support native embedding with packages embed and io/fs.

    Describe the solution you'd like

    Update minimal golang required version to 1.16 and provide MigrationSource with support embed.FS. I'll provide pull request a little bit later.

    opened by insidieux 6
  • returns undefined: migrate.SetIgnoreUnknown

    returns undefined: migrate.SetIgnoreUnknown

    When we try to ignore the comparision check by adding migrate.SetIgnoreUnknown(true) it returns undefined but the Exec, SetSchema functions works fine.

    opened by s-mani 0
  • Update installation command

    Update installation command

    Beginners might get confused when installing packages and this old command is no more applicable. Changing the installation instruction to use the latest go install command is helpful and might potentially save a couple hours of wondering why the sql-migrate CLI tool is not being found by the go environment in local.

    Closes #213.

    opened by nikhil1011 0
  • sql-migrate CLI tool not being added to path with the installation command provided. `zsh: command not found: sql-migrate`

    sql-migrate CLI tool not being added to path with the installation command provided. `zsh: command not found: sql-migrate`

    Tried using Go 1.18 (the latest release as of March 20, 2022) and Go 1.17.8 (latest older release) on my Macbook Pro running MacOS Monterey Version 12.1 (21C52). The sql-migrate command is not getting added to the PATH variable. I have looked extensively and don't find a solution to adding this to the path without doing it manually. I would like to not do it manually.

    Basically I'm getting zsh: command not found: sql-migrate when I try to run sql-migrate command on my terminal running zsh. Even when I switch to bash it doesn't work.

    I can see that the package is being installed in $HOME/go/pkg/mod/github.com/rubenv/[email protected].

    Is this a known issue or am I missing something? How can I solve this?

    opened by nikhil1011 4
  • sql-migrate status fails with

    sql-migrate status fails with "Could not create constraint or index"

    $ go get -v github.com/rubenv/sql-migrate/[email protected]
    $ sql-migrate status -env="dev"
    mssql: Could not create constraint or index. See previous errors.
    

    How can I see previous errors as nothing else is output in the terminal. Also why is a constraint or index attempting to be created when running the status command?

    opened by esetnik 2
Owner
Ruben Vermeersch
Ruben Vermeersch
SQL schema migration tool for Go.

sql-migrate SQL Schema migration tool for Go. Based on gorp and goose. Using modl? Check out modl-migrate. Features Usable as a CLI tool or as a libra

Ruben Vermeersch 2.5k Jun 21, 2022
Dbmate is a database migration tool, to keep your database schema in sync across multiple developers and your production servers.

Dbmate is a database migration tool, to keep your database schema in sync across multiple developers and your production servers. It is a stand

Adrian Macneil 2.6k Jun 22, 2022
Migration - Commonly used migration tools

Migration Commonly used migration tools Usage package main import ( "context"

infinite loop 0 Feb 16, 2022
Migration - Commonly used migration tools

Migration Commonly used migration tools Usage package main import ( "context"

infinite loop 0 Feb 16, 2022
Goose database migration tool - fork of https://bitbucket.org/liamstask/goose

goose Goose is a database migration tool. Manage your database schema by creating incremental SQL changes or Go functions. Goals of this fork github.c

Pressly Inc. 2.8k Jun 24, 2022
Simple Migration Tool - written in Go

Pravasan Simple Migration tool intend to be used for any languages, for any db. Please feel free to criticize, comment, etc. Currently this is working

null 28 Apr 13, 2022
Simple migration tool for MySQL

prrn Simple migration tool for MySQL This is a CLI that helps you create a DB migration file. There is no need to write up and down files from scratch

kamijin_fanta 7 Nov 10, 2021
A database migration tool written in Go.

dbmagritte created by Austin Poor A database migration tool written in Go. Usage Commands: init: Set up the repo by creating a .dbmagritte.yaml file a

Austin Poor 0 Jan 29, 2022
Minimalistic database migration helper for Gorm ORM

Gormigrate Gormigrate is a minimalistic migration helper for Gorm. Gorm already has useful migrate functions, just misses proper schema versioning and

null 787 Jun 30, 2022
Dead simple Go database migration library.

migrator Dead simple Go database migration library. Features Simple code Usage as a library, embeddable and extensible on your behalf Support of any d

David Lobe 128 Jun 22, 2022
Database migration through structures - development

goMigration 基于 Golang 的数据库迁移工具,目前仍在开发中,有兴趣的小伙伴可以联系我一起~ 食用方法 go get https://github.com/DGuang21/goMigration 手动将其安装 可通过 gom gen create_c_user_table 方法生

Daguang 3 Dec 2, 2021
A migration engine to deploy database changes in your golang + mongodb app.

bisonmigration A migration engine to deploy database changes in your golang + mongodb app. Migration files register their UP and DOWN functions in the

F. Levanti 0 Jan 30, 2022
Database schema evolution library for Go

Try browsing the code on Sourcegraph! Darwin Database schema evolution library for Go Example package main import ( "database/sql" "log" "github.

Guiabolso 130 Apr 26, 2022
Schema management CLI for MySQL

Skeema is a tool for managing MySQL tables and schema changes in a declarative fashion using pure SQL. It provides a CLI tool allowing you to: Export

Skeema 1k Jun 21, 2022
GitHub's Online Schema Migrations for MySQL

gh-ost GitHub's online schema migration for MySQL gh-ost is a triggerless online schema migration solution for MySQL. It is testable and provides paus

Leon 0 Apr 3, 2020
entimport is a tool for creating Ent schemas from existing SQL databases.

entimport entimport is a tool for creating Ent schemas from existing SQL databases. Currently, MySQL and PostgreSQL are supported. The tool can import

ariga 80 Jun 27, 2022
Django style fixtures for Golang's excellent built-in database/sql library.

go-fixtures Django style fixtures for Golang's excellent built-in database/sql library. Currently only YAML fixtures are supported. There are two rese

Richard Knop 27 Mar 8, 2022
Opinionated tool for database structure management and migrations

trek Requirements At least version 13 of postgres is needed. Installation go install . Setup Create config.yaml: model_name: <model_name> db_name: <db

Stack11 3 Jan 7, 2022
Tool to handle versioned migrations with gorm

GORM Migrations About Gorm Migrations Gorm Migrations is a tool designed for go-gorm. Gorm Migration takes the pain out of development of migrations v

null 5 Mar 14, 2022