All Projects → jaemk → migrant

jaemk / migrant

Licence: MIT license
Migration management for PostgreSQL/SQLite/MySQL

Programming Languages

rust
11053 projects
shell
77523 projects
powershell
5483 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to migrant

db-migrator.go
DB migrations. CLI and Golang
Stars: ✭ 13 (-84.71%)
Mutual labels:  migrations, database-migrations
Goose
A database migration tool. Supports SQL migrations and Go functions.
Stars: ✭ 2,112 (+2384.71%)
Mutual labels:  migrations, database-migrations
migrant lib
Embeddable migration management
Stars: ✭ 22 (-74.12%)
Mutual labels:  migrations, database-migrations
upscheme
Database migrations and schema updates made easy
Stars: ✭ 737 (+767.06%)
Mutual labels:  migrations, database-migrations
migrations
Migrations is a database migration tool that uses go's database/sql from the standard library
Stars: ✭ 17 (-80%)
Mutual labels:  migrations, database-migrations
mongo-migrate
Versioned migrations for MongoDB.
Stars: ✭ 79 (-7.06%)
Mutual labels:  migrations, database-migrations
sync-db
Utility to synchronize relational database objects across databases.
Stars: ✭ 15 (-82.35%)
Mutual labels:  migrations, database-migrations
Phinx
PHP Database Migrations for Everyone
Stars: ✭ 4,245 (+4894.12%)
Mutual labels:  migrations, database-migrations
Phoenix
Framework agnostic database migrations for PHP.
Stars: ✭ 81 (-4.71%)
Mutual labels:  migrations, database-migrations
Migrate Mongo
A database migration tool for MongoDB in Node
Stars: ✭ 481 (+465.88%)
Mutual labels:  migrations, database-migrations
Dbmate
🚀 A lightweight, framework-agnostic database migration tool.
Stars: ✭ 2,228 (+2521.18%)
Mutual labels:  migrations, 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 (+1503.53%)
Mutual labels:  migrations, database-migrations
Postgres Migrations
🐦 A Stack Overflow-inspired PostgreSQL migration library with strict ordering and immutable migrations
Stars: ✭ 161 (+89.41%)
Mutual labels:  migrations, database-migrations
Secondbase
Seamless second database integration for Rails.
Stars: ✭ 216 (+154.12%)
Mutual labels:  migrations
r2dbc-migrate
R2DBC database migration tool & library
Stars: ✭ 83 (-2.35%)
Mutual labels:  database-migrations
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 2,315 (+2623.53%)
Mutual labels:  migrations
Cli
The Sequelize CLI
Stars: ✭ 2,248 (+2544.71%)
Mutual labels:  migrations
strong migrations
Catch unsafe migrations in your Elixir application
Stars: ✭ 58 (-31.76%)
Mutual labels:  migrations
database-migrations-dotnet
A code example showing 5 ways to manage database schema in .NET
Stars: ✭ 44 (-48.24%)
Mutual labels:  database-migrations
Laravel Migrate Fresh
An artisan command to build up a database from scratch
Stars: ✭ 179 (+110.59%)
Mutual labels:  migrations

Migrant

Build Status crates.io:migrant

Basic migration manager powered by migrant_lib

Supported databases/features:

Feature Backend
postgres Enable postgres connectivity
sqlite Enable sqlite connectivity
mysql Enable mysql connectivity
update Enable self-update functionality

migrant will manage all migrations that live under <project-dir>/migrations/, where project-dir is the closest parent path that contains a Migrant.toml configuration file (..../<project-dir>/Migrant.toml). The default migration file location can be modified in your Migrant.toml file ("migration_location"). If the migration_location directory doesn't exist, it will be created the first time you create a new migration. migrant stores all applied migrations in a database table named __migrant_migrations.

Note: Configuration values prefixed with env: in your Migrant.toml will be sourced from environment variables. For example, database_user = "env:DB_USER" will use the value of the environment variable DB_USER. If a .env. file exists, it will be "sourced" automatically before your Migrant.toml is loaded.

Note: SQL statements are batch executed as is. If you want your migration to happen atomically in a transaction you must manually wrap your statements in a transaction (begin transaction; ... commit;).

Installation

Binary releases:

See releases for binaries. If you've already installed a binary release, you can update to the latest release via migrant self update.

Building from source:

By default migrant will build without any features, falling back to using each database's cli commands (psql / sqlite3 / mysqlsh). The postgres, rusqlite, and mysql database driver libraries can be activated with their respective feature flags. Note, Some drivers require their dev libraries (postgresql: libpq-dev, sqlite: libsqlite3-dev). Self update functionality (updating to the latest GitHub release) is available behind the update feature. The binary releases are built with all features.

Building from source (crates.io):

# install without features
# use cli commands for all db interaction
cargo install migrant

# install with `postgres`
cargo install migrant --features postgres

# install with `rusqlite`
cargo install migrant --features sqlite

# all
cargo install migrant --features 'postgres sqlite mysql update'

Simple Usage

migrant init [--type <database-type>, --location <project-dir>, --no-confirm] - Initialize project by creating a Migrant.toml file with db info/credentials. When run interactively (without --no-confirm), setup will be run automatically.

migrant setup - Verify database info/credentials and setup a __migrant_migrations table if missing.

migrant new <tag> - Generate new up & down files with the given <tag> under the specified migration_location.

migrant edit <tag> [--down] - Edit the up [or down] migration file with the given <tag>.

migrant list - Display all available .sql files and mark those applied.

migrant apply [--down, --all, --force, --fake] - Apply the next available migration[s].

migrant shell - Open a repl

migrant which-config - Display the full path of the Migrant.toml file being used

migrant connect-string - Display either the connection-string generated from config-params or the database-path for sqlite

migrant self update - Update to the latest version released on GitHub.

migrant self bash-completions install [--path <path>] - Generate a bash completion script and save it to the default or specified path.

Usage as a library

See migrant_lib and examples. migrant itself is just a thin wrapper around migrant_lib, so the full functionality of migration management can be embedded in your actual project.

Development

See CONTRIBUTING

Docker

An image with the binary installed is available at jaemk/migrant:latest

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