modulepackage
0.0.1
Repository: https://github.com/matthewmueller/migrate.git
Documentation: pkg.go.dev
# README
migrate
No-frills migration utility for PostgreSQL and SQLite.
Features
- Stable and in use across 10+ projects over 3 years.
- Supports migrations from a virtual file-system
- Supports several SQLite3 modules (full-text search, json, foreign keys, etc.)
Installation
go get github.com/matthewmueller/migrate
Usage
Usage:
migrate [<flags>] <command> [<args> ...]
Flags:
-h, --help Output usage information.
--dir="./migrate" migrations directory
--table="migrate" table name
--db=DB database url (e.g. 'postgres://localhost:5432/db')
Commands:
help Show help for a command.
new create a new migration
up migrate up
down migrate down
reset reset all down then up migrations
redo redo the last migration
info info on the current migration
Help Wanted
- Generic driver interface
Authors
- Matt Mueller https://twitter.com/mattmueller
Running Tests
The tests depend on a local PostgreSQL database being present. Make sure you have PostgreSQL installed and then run the following from your terminal:
createdb migrate-test
Then you should be able to run:
make test
License
MIT
# Packages
No description provided by the author
# Functions
Connect to a database depending on the URL schema.
Down migrates the database down to 0.
DownBy migrations the database down by i.
LocalVersion fetches the latest local version.
New creates a new migrations in dir TODO: figure out a writable virtual file-system for this.
RemoteVersion fetches the latest local version.
Up migrates the database up to the latest migration.
UpBy migrations the database up by i.
# Variables
ErrNoMigrations happens when there are no migrations.
ErrNotEnoughMigrations happens when your migrations folder has less migrations than remote's version.
ErrZerothMigration occurs when the migrations start at 000.
# Interfaces
File is a writable file.
# Type aliases
Direction string.