SQL schema migration tool for Go.

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: root@/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/password@localhost: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/password@localhost: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.

Owner
Comments
  • 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.

  • 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

    mau@mbp15:~$ 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

    mau@mbp15:~$ 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"
    
  • 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.

  • 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
    
  • 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.

  • 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.

  • 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.
  • Behavior when unknown migration

    Behavior when unknown migration

    sql-migrate behaves badly when the database has migrations "unknown" to the current run of sql-migrate. This is most likely to happen when a diverged branch applied its migrations to a database while another branch also applied its own migrations to a database.

    For example:

    1. branch A: 1, 2, 3
    2. branch B: 1, 2, 4
    3. branch B applies against DB. State is now "1, 2, 4"
    4. branch A tries to apply against DB. Migration "4" is unknown.

    See existing issue: https://github.com/rubenv/sql-migrate/issues/37

    How should sql-migrate behave when asked to perform a migration against a database that has unknown migrations? I can think of two reasonable behaviors:

    1. Complain that unknown migrations exist. Require the user to pass a -f force flag to complete the migrations. I'm not sure how the library should change, but I could work up some suggestions.
    2. Do the best we can. When migrating up, ignore the unknown migrations. When migrating down, fail upon encountering an unknown migration.

    (For option 2, we could also allow migrating down by adding a migrate_down column to the migrations table and storing the SQL at migrate up time. That doesn't help any existing installations, but would be a way forward.)

    Which behavior seems best? I'm in favor of 2, but see the merits of 1.

  • 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?

  • 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?

  • 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.

  • Support for multiple migration dirs

    Support for multiple migration dirs

    I think a rather common scenario is to have a set of migrations that apply to all environments, and a set of (often data, not schema) migrations which are environment specific. The only way I see sql-migrate currently supporting this out of the box is if the user somehow arranges all migration files into a single migration dir, for example by duplicating the common ones in all dirs having also environment specific ones. Or a pre-run script that copies files around. Would be great to improve on this.

    There are some existing issues here that propose implementing a MigrationSource according to one's liking. That's fine when used as a library, but a chore when using the command line tool. My current use case is not written in Go, so a project that produces an command line tool with the changed behavior would have to be created.

    I'm proposing a change that would allow specifying multiple directories as the source. Files from them would be "interleaved" or "flattened" when determining the order, solely based on the files' basename, completely ignoring the dir they reside in. So for example,

    migrations
    ├── 20221029143942-base.sql
    ├── 20221029144011-schema-change.sql
    ├── dev
    │   └── 20221029143950-dev-data.sql
    └── prod
        └── 20221029143954-prod-data.sql
    

    ...would with an environment configured to use dirs migrations and migrations/dev produce the sequence

    20221029143942-base.sql
    20221029143950-dev-data.sql
    20221029144011-schema-change.sql
    

    Interleaving is necessary due to the general incremental/dependent nature of migrations. If it wasn't, multiple environments could be created and applied to the same db sequentially. But unfortunately that doesn't work.

    I believe this implementation would satisfy all existing cases I was able to find in the tracker here. Another thing I thought of was to add include/exclude filters to apply to filenames, but that gets hairy and doesn't scale as well as multiple dirs.

    As far as actual implementation goes, a new key dirs could be added that would take multiple dirs, or dir processing could be changed so that multiple dirs could be specified in it for example using ; as a separator (same one everywhere for config platform independence).

    If the idea is accepted, I can look into creating a PR for it.

  • Add snowflake support and upgrade gorp dependency to v3.1.0

    Add snowflake support and upgrade gorp dependency to v3.1.0

    I would love to use sql migrate for handling database schema changes in snowflake db, as we are already using it for some ETL jobs with a PG database. This adds snowflake support (needed to be added to gorp first, where it was added with the v3.1.0 release)

  • SetTable fails race detector

    SetTable fails race detector

    The SetTable function is problematic if you have parallel go tests that spin up a new database and run the migrations on each individual one. It fails the go race detector as well. I'm forced to use a TestMain function to do this I guess, but what would you do if you want to set a different migration table in different parallel tests? Is there a particular reason it was chosen to make this essentially a mutable variable on the package itself as opposed to simply passing it as an option to Exec?

  • IgnoreUnknown is not working

    IgnoreUnknown is not working

    I have this configuration and am trying to set ignore unknown as true

    development:
      dialect: postgres
      datasource: <>
      sslmode=disable
      dir: migrations
      table: migrations
      ignoreunknown: true
    

    Even after setting this, It is giving me err unknown migration in database

  • 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.

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

Jan 2, 2023
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

Jan 1, 2023
Migration - Commonly used migration tools

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

Feb 16, 2022
Migration - Commonly used migration tools

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

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

Dec 30, 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

Sep 26, 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

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

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

Dec 25, 2022
Dead simple Go database migration library.
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

Nov 9, 2022
Database migration through structures - development

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

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

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.

Dec 5, 2022
Schema management CLI for MySQL
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

Dec 27, 2022
GitHub's Online Schema Migrations for MySQL
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

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

Dec 23, 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

Sep 26, 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

Dec 14, 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

Mar 14, 2022