All Projects → maragudk → migrate

maragudk / migrate

Licence: MIT license
A simple database migration tool.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to migrate

Laravel Sync Migration
Developer tool helps to sync migrations without refreshing the database
Stars: ✭ 89 (+134.21%)
Mutual labels:  database-migrations
Dbmate
🚀 A lightweight, framework-agnostic database migration tool.
Stars: ✭ 2,228 (+5763.16%)
Mutual labels:  database-migrations
Obevo
Obevo is a database deployment tool that handles enterprise scale schemas and complexity
Stars: ✭ 192 (+405.26%)
Mutual labels:  database-migrations
Lol dba
lol_dba is a small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts.
Stars: ✭ 1,363 (+3486.84%)
Mutual labels:  database-migrations
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (+213.16%)
Mutual labels:  database-migrations
Yuniql
Free and open source schema versioning and database migration made natively with .NET Core.
Stars: ✭ 156 (+310.53%)
Mutual labels:  database-migrations
Phoenix
Framework agnostic database migrations for PHP.
Stars: ✭ 81 (+113.16%)
Mutual labels:  database-migrations
database-migrations-dotnet
A code example showing 5 ways to manage database schema in .NET
Stars: ✭ 44 (+15.79%)
Mutual labels:  database-migrations
Flyway Docker
Official Flyway Docker images
Stars: ✭ 123 (+223.68%)
Mutual labels:  database-migrations
Scala Forklift
Type-safe data migration tool for Slick, Git and beyond.
Stars: ✭ 180 (+373.68%)
Mutual labels:  database-migrations
Flyway Sbt
Flyway SBT plugin
Stars: ✭ 101 (+165.79%)
Mutual labels:  database-migrations
Slick Migration Api
Schema manipulation dialects and DSL for Slick (mirrored from gitlab)
Stars: ✭ 116 (+205.26%)
Mutual labels:  database-migrations
Postgres Migrations
🐦 A Stack Overflow-inspired PostgreSQL migration library with strict ordering and immutable migrations
Stars: ✭ 161 (+323.68%)
Mutual labels:  database-migrations
Prana
Golang Database Management and Code Generation
Stars: ✭ 89 (+134.21%)
Mutual labels:  database-migrations
Liquibase
Main Liquibase Source
Stars: ✭ 2,910 (+7557.89%)
Mutual labels:  database-migrations
Flask Restplus Server Example
Real-life RESTful server example on Flask-RESTplus
Stars: ✭ 1,240 (+3163.16%)
Mutual labels:  database-migrations
Micrate
Database migration tool written in Crystal
Stars: ✭ 128 (+236.84%)
Mutual labels:  database-migrations
r2dbc-migrate
R2DBC database migration tool & library
Stars: ✭ 83 (+118.42%)
Mutual labels:  database-migrations
Aerich
A database migrations tool for TortoiseORM, ready to production.
Stars: ✭ 240 (+531.58%)
Mutual labels:  database-migrations
Phinx Migrations Generator
A Migration Code Generator for Phinx
Stars: ✭ 178 (+368.42%)
Mutual labels:  database-migrations

Migrate

GoDoc Go

A simple database migration tool using an sql.DB connection and fs.FS for the migration source. It has no non-test dependencies.

Made in 🇩🇰 by maragu, maker of online Go courses.

Features

  • Simple: The common usage is a one-liner.
  • Safe: Each migration is run in a transaction, and automatically rolled back on errors.
  • Flexible: Setup a custom migrations table and use callbacks before and after each migration.

Usage

go get -u github.com/maragudk/migrate
package main

import (
	"context"
	"database/sql"
	"os"

	_ "github.com/jackc/pgx/v4/stdlib"
	"github.com/maragudk/migrate"
)

// migrations is a directory with sql files that look something like this:
// migrations/1-accounts.up.sql
// migrations/1-accounts.down.sql
// migrations/2-users.up.sql
// migrations/2-users.down.sql
var migrations = os.DirFS("migrations")

func main() {
	db, err := sql.Open("pgx", "postgresql://postgres:123@localhost:5432/postgres?sslmode=disable")
	if err != nil {
		panic(err)
	}

	if err := migrate.Up(context.Background(), db, migrations); err != nil {
		panic(err)
	}

	if err := migrate.Down(context.Background(), db, migrations); err != nil {
		panic(err)
	}

	if err := migrate.To(context.Background(), db, migrations, "1-accounts"); err != nil {
		panic(err)
	}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].