Skip to content

Commit

Permalink
Merge pull request rubenv#154 from codestation/feature-packr2
Browse files Browse the repository at this point in the history
Use packr v2 on examples and tests
  • Loading branch information
rubenv authored Nov 16, 2019
2 parents 9355dd0 + d787e50 commit ce2300b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ migrations := &migrate.FileMigrationSource{
// OR: Use migrations from a packr box
migrations := &migrate.PackrMigrationSource{
Box: packr.NewBox("./migrations"),
Box: packr.New("migrations", "./migrations"),
}
// OR: Use migrations from bindata:
Expand Down Expand Up @@ -250,11 +250,17 @@ If you like your Go applications self-contained (that is: a single binary): use

Just write your migration files as usual, as a set of SQL files in a folder.

Import the packr package into your application:

```go
import "github.com/gobuffalo/packr/v2"
```

Use the `PackrMigrationSource` in your application to find the migrations:

```go
migrations := &migrate.PackrMigrationSource{
Box: packr.NewBox("./migrations"),
Box: packr.New("migrations", "./migrations"),
}
```

Expand Down
4 changes: 2 additions & 2 deletions migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"net/http"

"github.com/gobuffalo/packr"
"github.com/gobuffalo/packr/v2"
_ "github.com/mattn/go-sqlite3"
. "gopkg.in/check.v1"
"gopkg.in/gorp.v1"
Expand Down Expand Up @@ -162,7 +162,7 @@ func (s *SqliteMigrateSuite) TestAssetMigrate(c *C) {

func (s *SqliteMigrateSuite) TestPackrMigrate(c *C) {
migrations := &PackrMigrationSource{
Box: packr.NewBox("test-migrations"),
Box: packr.New("migrations", "test-migrations"),
}

// Executes two migrations
Expand Down

0 comments on commit ce2300b

Please sign in to comment.