From 092f48fc317a57460a495edcc86a0544117f5487 Mon Sep 17 00:00:00 2001 From: Dan B Date: Mon, 5 Mar 2018 13:09:59 +0000 Subject: [PATCH 1/8] Made command more importable --- cmd/goose/main.go | 115 +------------------------------ command.go | 113 ++++++++++++++++++++++++++++++ examples/go-migrations/README.md | 13 +--- 3 files changed, 117 insertions(+), 124 deletions(-) create mode 100644 command.go diff --git a/cmd/goose/main.go b/cmd/goose/main.go index 6e726fba1..1d5067550 100644 --- a/cmd/goose/main.go +++ b/cmd/goose/main.go @@ -1,122 +1,9 @@ package main import ( - "database/sql" - "flag" - "log" - "os" - "github.com/pressly/goose" - - // Init DB drivers. - _ "github.com/go-sql-driver/mysql" - _ "github.com/lib/pq" - _ "github.com/mattn/go-sqlite3" - _ "github.com/ziutek/mymysql/godrv" -) - -var ( - flags = flag.NewFlagSet("goose", flag.ExitOnError) - dir = flags.String("dir", ".", "directory with migration files") ) func main() { - flags.Usage = usage - flags.Parse(os.Args[1:]) - - args := flags.Args() - - if len(args) > 1 && args[0] == "create" { - if err := goose.Run("create", nil, *dir, args[1:]...); err != nil { - log.Fatalf("goose run: %v", err) - } - return - } - - if len(args) < 3 { - flags.Usage() - return - } - - if args[0] == "-h" || args[0] == "--help" { - flags.Usage() - return - } - - driver, dbstring, command := args[0], args[1], args[2] - - if err := goose.SetDialect(driver); err != nil { - log.Fatal(err) - } - - switch driver { - case "redshift": - driver = "postgres" - case "tidb": - driver = "mysql" - } - - switch dbstring { - case "": - log.Fatalf("-dbstring=%q not supported\n", dbstring) - default: - } - - db, err := sql.Open(driver, dbstring) - if err != nil { - log.Fatalf("-dbstring=%q: %v\n", dbstring, err) - } - - arguments := []string{} - if len(args) > 3 { - arguments = append(arguments, args[3:]...) - } - - if err := goose.Run(command, db, *dir, arguments...); err != nil { - log.Fatalf("goose run: %v", err) - } + goose.Command() } - -func usage() { - log.Print(usagePrefix) - flags.PrintDefaults() - log.Print(usageCommands) -} - -var ( - usagePrefix = `Usage: goose [OPTIONS] DRIVER DBSTRING COMMAND - -Drivers: - postgres - mysql - sqlite3 - redshift - -Examples: - goose sqlite3 ./foo.db status - goose sqlite3 ./foo.db create init sql - goose sqlite3 ./foo.db create add_some_column sql - goose sqlite3 ./foo.db create fetch_user_data go - goose sqlite3 ./foo.db up - - goose postgres "user=postgres dbname=postgres sslmode=disable" status - goose mysql "user:password@/dbname?parseTime=true" status - goose redshift "postgres://user:password@qwerty.us-east-1.redshift.amazonaws.com:5439/db" status - goose tidb "user:password@/dbname?parseTime=true" status - -Options: -` - - usageCommands = ` -Commands: - up Migrate the DB to the most recent version available - up-to VERSION Migrate the DB to a specific VERSION - down Roll back the version by 1 - down-to VERSION Roll back to a specific VERSION - redo Re-run the latest migration - reset Roll back all migrations - status Dump the migration status for the current DB - version Print the current version of the database - create NAME [sql|go] Creates new migration file with next version -` -) diff --git a/command.go b/command.go new file mode 100644 index 000000000..2358cac50 --- /dev/null +++ b/command.go @@ -0,0 +1,113 @@ +package goose + +import ( + "database/sql" + "flag" + "log" + "os" + _ "migrations" + + // Init DB drivers. + _ "github.com/go-sql-driver/mysql" + _ "github.com/lib/pq" + _ "github.com/mattn/go-sqlite3" + _ "github.com/ziutek/mymysql/godrv" +) + +var ( + flags = flag.NewFlagSet("goose", flag.ExitOnError) + dir = flags.String("dir", ".", "directory with migration files") +) + +func Command() { + flags.Usage = usage + flags.Parse(os.Args[1:]) + + args := flags.Args() + + if len(args) > 1 && args[0] == "create" { + if err := Run("create", nil, *dir, args[1:]...); err != nil { + log.Fatalf("goose run: %v", err) + } + return + } + + if len(args) < 3 { + flags.Usage() + return + } + + if args[0] == "-h" || args[0] == "--help" { + flags.Usage() + return + } + + driver, dbstring, command := args[0], args[1], args[2] + + switch driver { + case "postgres", "mysql", "sqlite3", "redshift": + if err := SetDialect(driver); err != nil { + log.Fatal(err) + } + default: + log.Fatalf("%q driver not supported\n", driver) + } + + db, err := sql.Open(driver, dbstring) + if err != nil { + log.Fatalf("-dbstring=%q: %v\n", dbstring, err) + } + + arguments := []string{} + if len(args) > 3 { + arguments = append(arguments, args[3:]...) + } + + if err := Run(command, db, *dir, arguments...); err != nil { + log.Fatalf("goose run: %v", err) + } +} + +func usage() { + log.Print(usagePrefix) + flags.PrintDefaults() + log.Print(usageCommands) +} + +var ( + usagePrefix = `Usage: goose [OPTIONS] DRIVER DBSTRING COMMAND + +Drivers: + postgres + mysql + sqlite3 + redshift + +Examples: + goose sqlite3 ./foo.db status + goose sqlite3 ./foo.db create init sql + goose sqlite3 ./foo.db create add_some_column sql + goose sqlite3 ./foo.db create fetch_user_data go + goose sqlite3 ./foo.db up + + goose postgres "user=postgres dbname=postgres sslmode=disable" status + goose mysql "user:password@/dbname?parseTime=true" status + goose redshift "postgres://user:password@qwerty.us-east-1.redshift.amazonaws.com:5439/db" status + goose tidb "user:password@/dbname?parseTime=true" status + +Options: +` + + usageCommands = ` +Commands: + up Migrate the DB to the most recent version available + up-to VERSION Migrate the DB to a specific VERSION + down Roll back the version by 1 + down-to VERSION Roll back to a specific VERSION + redo Re-run the latest migration + reset Roll back all migrations + status Dump the migration status for the current DB + version Print the current version of the database + create NAME [sql|go] Creates new migration file with next version +` +) diff --git a/examples/go-migrations/README.md b/examples/go-migrations/README.md index 5954ec629..2538acc0b 100644 --- a/examples/go-migrations/README.md +++ b/examples/go-migrations/README.md @@ -27,15 +27,8 @@ $ ## Best practice: Split migrations into a standalone package -1. Move [main.go](main.go) into your `cmd/` directory +1. Move [main.go](main.go) into your `src/cmd/` directory -2. Rename package name in all `*_.go` migration files from `main` to `migrations`. +2. Create `src/migrations/` directory with your migrations named `#######_migration_name.go` with the package declared as `migrations`. -3. Import this `migrations` package from your custom [cmd/main.go](main.go) file: - - ```go - import ( - // Invoke init() functions within migrations pkg. - _ "github.com/pressly/goose/example/migrations-go" - ) - ``` +3. Build the go package: `$ go build -o goose src/cmd/*.go` From 131c4c2b3563463ac4cd82b352aa44e3c6e690e7 Mon Sep 17 00:00:00 2001 From: Dan B Date: Mon, 5 Mar 2018 13:13:28 +0000 Subject: [PATCH 2/8] Removed example main.go --- examples/go-migrations/main.go | 122 --------------------------------- 1 file changed, 122 deletions(-) delete mode 100644 examples/go-migrations/main.go diff --git a/examples/go-migrations/main.go b/examples/go-migrations/main.go deleted file mode 100644 index 64226ea3a..000000000 --- a/examples/go-migrations/main.go +++ /dev/null @@ -1,122 +0,0 @@ -package main - -import ( - "database/sql" - "flag" - "log" - "os" - - "github.com/pressly/goose" - - // Init DB drivers. - _ "github.com/go-sql-driver/mysql" - _ "github.com/lib/pq" - _ "github.com/mattn/go-sqlite3" - _ "github.com/ziutek/mymysql/godrv" -) - -var ( - flags = flag.NewFlagSet("goose", flag.ExitOnError) - dir = flags.String("dir", ".", "directory with migration files") -) - -func main() { - flags.Usage = usage - flags.Parse(os.Args[1:]) - - args := flags.Args() - - if len(args) > 1 && args[0] == "create" { - if err := goose.Run("create", nil, *dir, args[1:]...); err != nil { - log.Fatalf("goose run: %v", err) - } - return - } - - if len(args) < 3 { - flags.Usage() - return - } - - if args[0] == "-h" || args[0] == "--help" { - flags.Usage() - return - } - - driver, dbstring, command := args[0], args[1], args[2] - - switch driver { - case "postgres", "mysql", "sqlite3", "redshift": - if err := goose.SetDialect(driver); err != nil { - log.Fatal(err) - } - default: - log.Fatalf("%q driver not supported\n", driver) - } - - switch dbstring { - case "": - log.Fatalf("-dbstring=%q not supported\n", dbstring) - default: - } - - if driver == "redshift" { - driver = "postgres" - } - - db, err := sql.Open(driver, dbstring) - if err != nil { - log.Fatalf("-dbstring=%q: %v\n", dbstring, err) - } - - arguments := []string{} - if len(args) > 3 { - arguments = append(arguments, args[3:]...) - } - - if err := goose.Run(command, db, *dir, arguments...); err != nil { - log.Fatalf("goose run: %v", err) - } -} - -func usage() { - log.Print(usagePrefix) - flags.PrintDefaults() - log.Print(usageCommands) -} - -var ( - usagePrefix = `Usage: goose [OPTIONS] DRIVER DBSTRING COMMAND - -Drivers: - postgres - mysql - sqlite3 - redshift - -Examples: - goose sqlite3 ./foo.db status - goose sqlite3 ./foo.db create init sql - goose sqlite3 ./foo.db create add_some_column sql - goose sqlite3 ./foo.db create fetch_user_data go - goose sqlite3 ./foo.db up - - goose postgres "user=postgres dbname=postgres sslmode=disable" status - goose mysql "user:password@/dbname?parseTime=true" status - goose redshift "postgres://user:password@qwerty.us-east-1.redshift.amazonaws.com:5439/db" status - -Options: -` - - usageCommands = ` -Commands: - up Migrate the DB to the most recent version available - up-to VERSION Migrate the DB to a specific VERSION - down Roll back the version by 1 - down-to VERSION Roll back to a specific VERSION - redo Re-run the latest migration - status Dump the migration status for the current DB - version Print the current version of the database - create NAME [sql|go] Creates new migration file with next version -` -) From 0b0d61dfb620fe0362e86a3700aa6c4e8da89642 Mon Sep 17 00:00:00 2001 From: Dan B Date: Thu, 22 Mar 2018 18:29:57 +0000 Subject: [PATCH 3/8] Fixed tests --- cmd/goose/main.go | 4 +++- examples/go-migrations/00002_rename_root.go | 7 ++++--- examples/go-migrations/README.md | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cmd/goose/main.go b/cmd/goose/main.go index 1d5067550..c4cb9b5fe 100644 --- a/cmd/goose/main.go +++ b/cmd/goose/main.go @@ -1,7 +1,9 @@ package main import ( - "github.com/pressly/goose" + "goose" + // In your repo, replace the line above with the line below: + // "github.com/pressly/goose" ) func main() { diff --git a/examples/go-migrations/00002_rename_root.go b/examples/go-migrations/00002_rename_root.go index 069d40afe..132020607 100644 --- a/examples/go-migrations/00002_rename_root.go +++ b/examples/go-migrations/00002_rename_root.go @@ -1,9 +1,10 @@ -package main +package migrations import ( "database/sql" - - "github.com/pressly/goose" + "goose" + // In your repo, replace the line above with the line below: + // "github.com/pressly/goose" ) func init() { diff --git a/examples/go-migrations/README.md b/examples/go-migrations/README.md index 2538acc0b..97ad44ac1 100644 --- a/examples/go-migrations/README.md +++ b/examples/go-migrations/README.md @@ -29,6 +29,8 @@ $ 1. Move [main.go](main.go) into your `src/cmd/` directory -2. Create `src/migrations/` directory with your migrations named `#######_migration_name.go` with the package declared as `migrations`. +2. Change import "goose" to import 'github.com/pressly/goose' -3. Build the go package: `$ go build -o goose src/cmd/*.go` +3. Create `src/migrations/` directory with your migrations named `#######_migration_name.go` with the package declared as `migrations`. + +4. Build the go package: `$ go build -o goose src/cmd/*.go` From 7c717ae2621797bc52b1b2545bd09f38be2ecf5e Mon Sep 17 00:00:00 2001 From: Dan B Date: Thu, 22 Mar 2018 19:05:48 +0000 Subject: [PATCH 4/8] fixed circular dependency --- cmd/goose/main.go | 3 ++- command.go | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/goose/main.go b/cmd/goose/main.go index c4cb9b5fe..4ca78cc4e 100644 --- a/cmd/goose/main.go +++ b/cmd/goose/main.go @@ -1,9 +1,10 @@ package main import ( + _ "migrations" "goose" // In your repo, replace the line above with the line below: - // "github.com/pressly/goose" + //"github.com/pressly/goose" ) func main() { diff --git a/command.go b/command.go index 2358cac50..61a514162 100644 --- a/command.go +++ b/command.go @@ -5,7 +5,6 @@ import ( "flag" "log" "os" - _ "migrations" // Init DB drivers. _ "github.com/go-sql-driver/mysql" From b89450ebd32e953a00253a64834e149b462627c3 Mon Sep 17 00:00:00 2001 From: Dan B Date: Thu, 22 Mar 2018 19:31:38 +0000 Subject: [PATCH 5/8] fixed tests --- cmd/goose/main.go | 3 --- examples/go-migrations/custom.go | 12 ++++++++++++ .../{ => migrations}/00001_create_users_table.sql | 0 .../{ => migrations}/00002_rename_root.go | 0 goose_test.go | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 examples/go-migrations/custom.go rename examples/go-migrations/{ => migrations}/00001_create_users_table.sql (100%) rename examples/go-migrations/{ => migrations}/00002_rename_root.go (100%) diff --git a/cmd/goose/main.go b/cmd/goose/main.go index 4ca78cc4e..6d2063e93 100644 --- a/cmd/goose/main.go +++ b/cmd/goose/main.go @@ -1,10 +1,7 @@ package main import ( - _ "migrations" "goose" - // In your repo, replace the line above with the line below: - //"github.com/pressly/goose" ) func main() { diff --git a/examples/go-migrations/custom.go b/examples/go-migrations/custom.go new file mode 100644 index 000000000..022530303 --- /dev/null +++ b/examples/go-migrations/custom.go @@ -0,0 +1,12 @@ +package main + +import ( + // Import your migrations directory here + _ "goose/examples/go-migrations/migrations" + // In your repo, replace "goose" line above with the path to goose: + "goose" //"github.com/pressly/goose" +) + +func main() { + goose.Command() +} diff --git a/examples/go-migrations/00001_create_users_table.sql b/examples/go-migrations/migrations/00001_create_users_table.sql similarity index 100% rename from examples/go-migrations/00001_create_users_table.sql rename to examples/go-migrations/migrations/00001_create_users_table.sql diff --git a/examples/go-migrations/00002_rename_root.go b/examples/go-migrations/migrations/00002_rename_root.go similarity index 100% rename from examples/go-migrations/00002_rename_root.go rename to examples/go-migrations/migrations/00002_rename_root.go diff --git a/goose_test.go b/goose_test.go index 4fe28b210..2588e4127 100644 --- a/goose_test.go +++ b/goose_test.go @@ -26,7 +26,7 @@ func TestDefaultBinary(t *testing.T) { func TestCustomBinary(t *testing.T) { commands := []string{ - "go build -i -o custom-goose ./examples/go-migrations", + "go build -i -o custom-goose ./examples/go-migrations/custom.go", "./custom-goose -dir=examples/go-migrations sqlite3 go.db up", "./custom-goose -dir=examples/go-migrations sqlite3 go.db version", "./custom-goose -dir=examples/go-migrations sqlite3 go.db down", From 7ad6b61cb93cea823e79081e2b301a6995e9952f Mon Sep 17 00:00:00 2001 From: Dan B Date: Thu, 22 Mar 2018 20:03:40 +0000 Subject: [PATCH 6/8] Test update --- cmd/{goose => }/main.go | 2 +- examples/go-migrations/README.md | 2 +- examples/go-migrations/custom.go | 2 +- goose_test.go | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) rename cmd/{goose => }/main.go (67%) diff --git a/cmd/goose/main.go b/cmd/main.go similarity index 67% rename from cmd/goose/main.go rename to cmd/main.go index 6d2063e93..1d5067550 100644 --- a/cmd/goose/main.go +++ b/cmd/main.go @@ -1,7 +1,7 @@ package main import ( - "goose" + "github.com/pressly/goose" ) func main() { diff --git a/examples/go-migrations/README.md b/examples/go-migrations/README.md index 97ad44ac1..59075e406 100644 --- a/examples/go-migrations/README.md +++ b/examples/go-migrations/README.md @@ -29,7 +29,7 @@ $ 1. Move [main.go](main.go) into your `src/cmd/` directory -2. Change import "goose" to import 'github.com/pressly/goose' +2. Adjust the imports to the paths for your project 3. Create `src/migrations/` directory with your migrations named `#######_migration_name.go` with the package declared as `migrations`. diff --git a/examples/go-migrations/custom.go b/examples/go-migrations/custom.go index 022530303..dfd355caf 100644 --- a/examples/go-migrations/custom.go +++ b/examples/go-migrations/custom.go @@ -4,7 +4,7 @@ import ( // Import your migrations directory here _ "goose/examples/go-migrations/migrations" // In your repo, replace "goose" line above with the path to goose: - "goose" //"github.com/pressly/goose" + "github.com/pressly/goose" ) func main() { diff --git a/goose_test.go b/goose_test.go index 2588e4127..62584af0b 100644 --- a/goose_test.go +++ b/goose_test.go @@ -8,7 +8,7 @@ import ( func TestDefaultBinary(t *testing.T) { commands := []string{ - "go build -i -o goose ./cmd/goose", + "go build -i -o goose ./cmd", "./goose -dir=examples/sql-migrations sqlite3 sql.db up", "./goose -dir=examples/sql-migrations sqlite3 sql.db version", "./goose -dir=examples/sql-migrations sqlite3 sql.db down", @@ -27,10 +27,10 @@ func TestDefaultBinary(t *testing.T) { func TestCustomBinary(t *testing.T) { commands := []string{ "go build -i -o custom-goose ./examples/go-migrations/custom.go", - "./custom-goose -dir=examples/go-migrations sqlite3 go.db up", - "./custom-goose -dir=examples/go-migrations sqlite3 go.db version", - "./custom-goose -dir=examples/go-migrations sqlite3 go.db down", - "./custom-goose -dir=examples/go-migrations sqlite3 go.db status", + "./custom-goose -dir=examples/go-migrations/migrations sqlite3 go.db up", + "./custom-goose -dir=examples/go-migrations/migrations sqlite3 go.db version", + "./custom-goose -dir=examples/go-migrations/migrations sqlite3 go.db down", + "./custom-goose -dir=examples/go-migrations/migrations sqlite3 go.db status", } for _, cmd := range commands { From ff196ab43584cbe0d750e92ab99f4a8b4effac6a Mon Sep 17 00:00:00 2001 From: Dan B Date: Thu, 22 Mar 2018 20:23:08 +0000 Subject: [PATCH 7/8] Fixed import paths --- examples/go-migrations/custom.go | 2 +- examples/go-migrations/migrations/00002_rename_root.go | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/go-migrations/custom.go b/examples/go-migrations/custom.go index dfd355caf..512561749 100644 --- a/examples/go-migrations/custom.go +++ b/examples/go-migrations/custom.go @@ -2,7 +2,7 @@ package main import ( // Import your migrations directory here - _ "goose/examples/go-migrations/migrations" + _ "github.com/pressly/goose/examples/go-migrations/migrations" // In your repo, replace "goose" line above with the path to goose: "github.com/pressly/goose" ) diff --git a/examples/go-migrations/migrations/00002_rename_root.go b/examples/go-migrations/migrations/00002_rename_root.go index 132020607..83bad01f7 100644 --- a/examples/go-migrations/migrations/00002_rename_root.go +++ b/examples/go-migrations/migrations/00002_rename_root.go @@ -2,9 +2,7 @@ package migrations import ( "database/sql" - "goose" - // In your repo, replace the line above with the line below: - // "github.com/pressly/goose" + "github.com/pressly/goose" ) func init() { From 8a4b5171f279e77713731a9729478b85e03c4170 Mon Sep 17 00:00:00 2001 From: Dan B Date: Wed, 11 Apr 2018 13:02:47 +0000 Subject: [PATCH 8/8] Updated namespace --- README.md | 16 ++++++++-------- cmd/main.go | 2 +- create.go | 2 +- examples/go-migrations/custom.go | 4 ++-- .../migrations/00002_rename_root.go | 2 +- examples/sql-migrations/README.md | 2 +- migration.go | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index efedf5ba0..10355ed2f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Goose is a database migration tool. Manage your database schema by creating incr ### Goals of this fork -`github.com/pressly/goose` is a fork of `bitbucket.org/liamstask/goose` with the following changes: +`github.com/discovery-digital/goose` is a fork of `bitbucket.org/liamstask/goose` with the following changes: - No config files - [Default goose binary](./cmd/goose/main.go) can migrate SQL files only - Go migrations: @@ -28,7 +28,7 @@ Goose is a database migration tool. Manage your database schema by creating incr # Install - $ go get -u github.com/pressly/goose/cmd/goose + $ go get -u github.com/discovery-digital/goose/cmd/goose This will install the `goose` binary to your `$GOPATH/bin` directory. @@ -205,7 +205,7 @@ language plpgsql; ## Go Migrations 1. Create your own goose binary, see [example](./examples/go-migrations) -2. Import `github.com/pressly/goose` +2. Import `github.com/discovery-digital/goose` 3. Register your migration functions 4. Run goose command, ie. `goose.Up(db *sql.DB, dir string)` @@ -217,7 +217,7 @@ package migrations import ( "database/sql" - "github.com/pressly/goose" + "github.com/discovery-digital/goose" ) func init() { @@ -245,7 +245,7 @@ func Down(tx *sql.Tx) error { Licensed under [MIT License](./LICENSE) -[GoDoc]: https://godoc.org/github.com/pressly/goose -[GoDoc Widget]: https://godoc.org/github.com/pressly/goose?status.svg -[Travis]: https://travis-ci.org/pressly/goose -[Travis Widget]: https://travis-ci.org/pressly/goose.svg?branch=master +[GoDoc]: https://godoc.org/github.com/discovery-digital/goose +[GoDoc Widget]: https://godoc.org/github.com/discovery-digital/goose?status.svg +[Travis]: https://travis-ci.org/discovery-digital/goose +[Travis Widget]: https://travis-ci.org/discovery-digital/goose.svg?branch=master diff --git a/cmd/main.go b/cmd/main.go index 1d5067550..334fbb83d 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/pressly/goose" + "github.com/discovery-digital/goose" ) func main() { diff --git a/create.go b/create.go index 48bc7f938..1635415e5 100644 --- a/create.go +++ b/create.go @@ -80,7 +80,7 @@ var goSQLMigrationTemplate = template.Must(template.New("goose.go-migration").Pa import ( "database/sql" - "github.com/pressly/goose" + "github.com/discovery-digital/goose" ) func init() { diff --git a/examples/go-migrations/custom.go b/examples/go-migrations/custom.go index 512561749..5df56dbe8 100644 --- a/examples/go-migrations/custom.go +++ b/examples/go-migrations/custom.go @@ -2,9 +2,9 @@ package main import ( // Import your migrations directory here - _ "github.com/pressly/goose/examples/go-migrations/migrations" + _ "github.com/discovery-digital/goose/examples/go-migrations/migrations" // In your repo, replace "goose" line above with the path to goose: - "github.com/pressly/goose" + "github.com/discovery-digital/goose" ) func main() { diff --git a/examples/go-migrations/migrations/00002_rename_root.go b/examples/go-migrations/migrations/00002_rename_root.go index 83bad01f7..ac0daca45 100644 --- a/examples/go-migrations/migrations/00002_rename_root.go +++ b/examples/go-migrations/migrations/00002_rename_root.go @@ -2,7 +2,7 @@ package migrations import ( "database/sql" - "github.com/pressly/goose" + "github.com/discovery-digital/goose" ) func init() { diff --git a/examples/sql-migrations/README.md b/examples/sql-migrations/README.md index f55ccfdb6..571ba116c 100644 --- a/examples/sql-migrations/README.md +++ b/examples/sql-migrations/README.md @@ -3,7 +3,7 @@ See [this example](../go-migrations) for Go migrations. ```bash -$ go get -u github.com/pressly/goose/cmd/goose +$ go get -u github.com/discovery-digital/goose/cmd/goose ``` ```bash diff --git a/migration.go b/migration.go index ce07f9416..e5f38faa3 100644 --- a/migration.go +++ b/migration.go @@ -60,7 +60,7 @@ func (m *Migration) run(db *sql.DB, direction bool) error { case ".go": if !m.Registered { - log.Fatalf("failed to apply Go migration %q: Go functions must be registered and built into a custom binary (see https://github.com/pressly/goose/tree/master/examples/go-migrations)", m.Source) + log.Fatalf("failed to apply Go migration %q: Go functions must be registered and built into a custom binary (see https://github.com/discovery-digital/goose/tree/master/examples/go-migrations)", m.Source) } tx, err := db.Begin() if err != nil {