Update README

pull/53/head
Vojtech Vitek 2017-06-20 12:26:48 -04:00 committed by GitHub
parent d0b5acabe5
commit ca9152bc76
1 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# SQL + Go migrations # SQL + Go migrations
## Example custom goose binary with built-in Go migrations ## This example: Custom goose binary with built-in Go migrations
```bash ```bash
$ go build -o goose *.go $ go build -o goose *.go
@ -29,14 +29,13 @@ $
1. Move [main.go](main.go) into your `cmd/` directory 1. Move [main.go](main.go) into your `cmd/` directory
2. Rename migration functions to `migrations` pkg 2. Rename package name in all `*_.go` migration files from `main` to `migrations`.
3. Import `migrations` package from [cmd/main.go](main.go) 3. Import this `migrations` package from your custom [cmd/main.go](main.go) file:
```go ```go
import ( import (
// Invoke init() functions within migrations pkg.
_ "github.com/pressly/goose/example/migrations-go" _ "github.com/pressly/goose/example/migrations-go"
) )
``` ```
This will cause all `init()` functions to be called within `migrations` pkg, thus registering the migration functions properly.