mirror of https://github.com/status-im/migrate.git
6c96ef02df
* Enabled maligned check * Enabled staticcheck * Fixes for golint * Enabled errcheck linter * Added fixes for error check * Added errcheck for tests * Fixed test * Increased golangci-lint deadline for travis * Increased golangci-lint deadline for travis * Decreased golangci-lint deadline for travis * Revert for backward compatibility * Using log.Println() instead of fmt.Println() * Handling os.RemoveAll() errors * Using t.Error(error) instead of t.Errorf("%v", err) * Using t.Fatal(error) instead of t.Fatalf("%v", err) * Using fmt.Sprint(sum) instead of t.Srintf("%v", sum) * Refactoring * Revert for backward compatibility * Revert * go mod tidy * Added error logging * Added error logging * Added error handling * Added error handling * Added error logging * Fix error logging * Added error handling * Fix * Added logging for migr.Buffer() * Fixes * Firebird test disabled * Fixed nolint comment * Updated firebird docker image version * Disabled test for firebird 2.5 * Fixed // nolint |
||
---|---|---|
.. | ||
examples/migrations | ||
testdata | ||
README.md | ||
go-bindata.go | ||
go-bindata_test.go |
README.md
go_bindata
Usage
Read bindata with NewWithSourceInstance
go get -u github.com/jteeuwen/go-bindata/...
cd examples/migrations && go-bindata -pkg migrations .
import (
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/source/go_bindata"
"github.com/golang-migrate/migrate/v4/source/go_bindata/examples/migrations"
)
func main() {
// wrap assets into Resource
s := bindata.Resource(migrations.AssetNames(),
func(name string) ([]byte, error) {
return migrations.Asset(name)
})
d, err := bindata.WithInstance(s)
m, err := migrate.NewWithSourceInstance("go-bindata", d, "database://foobar")
m.Up() // run your migrations and handle the errors above of course
}
Read bindata with URL (todo)
This will restore the assets in a tmp directory and then
proxy to source/file. go-bindata must be in your $PATH
.
migrate -source go-bindata://examples/migrations/bindata.go