diff --git a/README.md b/README.md index 0249346..38654a7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Build Status](https://travis-ci.org/golang-migrate/migrate.svg?branch=master)](https://travis-ci.org/golang-migrate/migrate) -[![GoDoc](https://godoc.org/github.com/mattes/migrate?status.svg)](https://godoc.org/github.com/mattes/migrate) +[![GoDoc](https://godoc.org/github.com/golang-migrate/migrate?status.svg)](https://godoc.org/github.com/golang-migrate/migrate) [![Coverage Status](https://coveralls.io/repos/github/golang-migrate/migrate/badge.svg)](https://coveralls.io/github/golang-migrate/migrate) [![packagecloud.io](https://img.shields.io/badge/deb-packagecloud.io-844fec.svg)](https://packagecloud.io/mattes/migrate?filter=debs) @@ -9,12 +9,12 @@ __Database migrations written in Go. Use as [CLI](#cli-usage) or import as [libr * Migrate reads migrations from [sources](#migration-sources) and applies them in correct order to a [database](#databases). - * Drivers are "dumb", migrate glues everything together and makes sure the logic is bulletproof. + * Drivers are "dumb", migrate glues everything together and makes sure the logic is bulletproof. (Keeps the drivers lightweight, too.) * Database drivers don't assume things or try to correct user input. When in doubt, fail. -Looking for [v1](https://github.com/mattes/migrate/tree/v1)? +Looking for [v1](https://github.com/golang-migrate/migrate/tree/v1)? ## Databases @@ -69,13 +69,13 @@ $ migrate -database postgres://localhost:5432/database up 2 * API is stable and frozen for this release (v3.x). * Package migrate has no external dependencies. * Only import the drivers you need. - (check [dependency_tree.txt](https://github.com/mattes/migrate/releases) for each driver) + (check [dependency_tree.txt](https://github.com/golang-migrate/migrate/releases) for each driver) * To help prevent database corruptions, it supports graceful stops via `GracefulStop chan bool`. * Bring your own logger. * Uses `io.Reader` streams internally for low memory overhead. * Thread-safe and no goroutine leaks. -__[Go Documentation](https://godoc.org/github.com/mattes/migrate)__ +__[Go Documentation](https://godoc.org/github.com/golang-migrate/migrate)__ ```go import ( diff --git a/cli/README.md b/cli/README.md index c0886d5..680066d 100644 --- a/cli/README.md +++ b/cli/README.md @@ -5,8 +5,8 @@ #### With Go toolchain ``` -$ go get -u -d github.com/mattes/migrate/cli github.com/lib/pq -$ go build -tags 'postgres' -o /usr/local/bin/migrate github.com/mattes/migrate/cli +$ go get -u -d github.com/golang-migrate/migrate/cli github.com/lib/pq +$ go build -tags 'postgres' -o /usr/local/bin/migrate github.com/golang-migrate/migrate/cli ``` Note: This example builds the cli which will only work with postgres. In order @@ -34,10 +34,10 @@ $ apt-get install -y migrate #### Download pre-build binary (Windows, MacOS, or Linux) -[Release Downloads](https://github.com/mattes/migrate/releases) +[Release Downloads](https://github.com/golang-migrate/migrate/releases) ``` -$ curl -L https://github.com/mattes/migrate/releases/download/$version/migrate.$platform-amd64.tar.gz | tar xvz +$ curl -L https://github.com/golang-migrate/migrate/releases/download/$version/migrate.$platform-amd64.tar.gz | tar xvz ``` diff --git a/database/mysql/README.md b/database/mysql/README.md index 490e90b..0cb1299 100644 --- a/database/mysql/README.md +++ b/database/mysql/README.md @@ -1,53 +1,53 @@ -# MySQL - -`mysql://user:password@tcp(host:port)/dbname?query` - -| URL Query | WithInstance Config | Description | -|------------|---------------------|-------------| -| `x-migrations-table` | `MigrationsTable` | Name of the migrations table | -| `dbname` | `DatabaseName` | The name of the database to connect to | -| `user` | | The user to sign in as | -| `password` | | The user's password | -| `host` | | The host to connect to. | -| `port` | | The port to bind to. | -| `x-tls-ca` | | The location of the root certificate file. | -| `x-tls-cert` | | Cert file location. | -| `x-tls-key` | | Key file location. | -| `x-tls-insecure-skip-verify` | | Whether or not to use SSL (true\|false) | - -## Use with existing client - -If you use the MySQL driver with existing database client, you must create the client with parameter `multiStatements=true`: - -```go -package main - -import ( - "database/sql" - - _ "github.com/go-sql-driver/mysql" - "github.com/mattes/migrate" - "github.com/mattes/migrate/database/mysql" - _ "github.com/mattes/migrate/source/file" -) - -func main() { - db, _ := sql.Open("mysql", "user:password@tcp(host:port)/dbname?multiStatements=true") - driver, _ := mysql.WithInstance(db, &mysql.Config{}) - m, _ := migrate.NewWithDatabaseInstance( - "file:///migrations", - "mysql", - driver, - ) - - m.Steps(2) -} -``` - -## Upgrading from v1 - -1. Write down the current migration version from schema_migrations -1. `DROP TABLE schema_migrations` -2. Wrap your existing migrations in transactions ([BEGIN/COMMIT](https://dev.mysql.com/doc/refman/5.7/en/commit.html)) if you use multiple statements within one migration. -3. Download and install the latest migrate version. -4. Force the current migration version with `migrate force `. +# MySQL + +`mysql://user:password@tcp(host:port)/dbname?query` + +| URL Query | WithInstance Config | Description | +|------------|---------------------|-------------| +| `x-migrations-table` | `MigrationsTable` | Name of the migrations table | +| `dbname` | `DatabaseName` | The name of the database to connect to | +| `user` | | The user to sign in as | +| `password` | | The user's password | +| `host` | | The host to connect to. | +| `port` | | The port to bind to. | +| `x-tls-ca` | | The location of the root certificate file. | +| `x-tls-cert` | | Cert file location. | +| `x-tls-key` | | Key file location. | +| `x-tls-insecure-skip-verify` | | Whether or not to use SSL (true\|false) | + +## Use with existing client + +If you use the MySQL driver with existing database client, you must create the client with parameter `multiStatements=true`: + +```go +package main + +import ( + "database/sql" + + _ "github.com/go-sql-driver/mysql" + "github.com/golang-migrate/migrate" + "github.com/golang-migrate/migrate/database/mysql" + _ "github.com/golang-migrate/migrate/source/file" +) + +func main() { + db, _ := sql.Open("mysql", "user:password@tcp(host:port)/dbname?multiStatements=true") + driver, _ := mysql.WithInstance(db, &mysql.Config{}) + m, _ := migrate.NewWithDatabaseInstance( + "file:///migrations", + "mysql", + driver, + ) + + m.Steps(2) +} +``` + +## Upgrading from v1 + +1. Write down the current migration version from schema_migrations +1. `DROP TABLE schema_migrations` +2. Wrap your existing migrations in transactions ([BEGIN/COMMIT](https://dev.mysql.com/doc/refman/5.7/en/commit.html)) if you use multiple statements within one migration. +3. Download and install the latest migrate version. +4. Force the current migration version with `migrate force `. diff --git a/source/go-bindata/README.md b/source/go-bindata/README.md index cd9dd4b..b222d99 100644 --- a/source/go-bindata/README.md +++ b/source/go-bindata/README.md @@ -13,9 +13,9 @@ cd examples/migrations && go-bindata -pkg migrations . ```go import ( - "github.com/mattes/migrate" - "github.com/mattes/migrate/source/go-bindata" - "github.com/mattes/migrate/source/go-bindata/examples/migrations" + "github.com/golang-migrate/migrate" + "github.com/golang-migrate/migrate/source/go-bindata" + "github.com/golang-migrate/migrate/source/go-bindata/examples/migrations" ) func main() {