Skip to content

Commit

Permalink
Merge pull request #397 from hnnsgstfssn/add-pkger-readme
Browse files Browse the repository at this point in the history
source/pkger: add readme
  • Loading branch information
dhui authored May 26, 2020
2 parents 3c71508 + 7b58ded commit 7236e82
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions source/pkger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# pkger
```
package main
import (
"errors"
"log"
"github.com/golang-migrate/migrate/v4"
"github.com/markbates/pkger"
_ "github.com/golang-migrate/migrate/v4/database/postgres"
_ "github.com/golang-migrate/migrate/v4/source/pkger"
_ "github.com/lib/pq"
)
func main() {
pkger.Include("/module/path/to/migrations")
m, err := migrate.New("pkger:///module/path/to/migrations", "postgres://postgres@localhost/postgres?sslmode=disable")
if err != nil {
log.Fatalln(err)
}
if err := m.Up(); errors.Is(err, migrate.ErrNoChange) {
log.Println(err)
} else if err != nil {
log.Fatalln(err)
}
}
```

0 comments on commit 7236e82

Please sign in to comment.