gopkg.in/zensey/migrate.v3@v3.0.0/source/go-bindata/README.md (about)

     1  # go-bindata
     2  
     3  
     4  ## Usage
     5  
     6  
     7  ```
     8  go get -u github.com/jteeuwen/go-bindata/...
     9  cd examples/migrations && go-bindata -pkg migrations .
    10  ```
    11  
    12  
    13  ```
    14  // TODO
    15  // this will restore the assets in a tmp directory and then 
    16  // proxy to source/file
    17  // go-bindata must be in your $PATH
    18  migrate -source go-bindata://examples/migrations/bindata.go 
    19  ```
    20  
    21  
    22  ```
    23  import (
    24    "github.com/mattes/migrate"
    25    "github.com/mattes/migrate/source/go-bindata"
    26    "github.com/mattes/migrate/source/go-bindata/examples/migrations
    27  )
    28  
    29  func main() {
    30  	// wrap assets into Resource
    31    s := bindata.Resource(migrations.AssetNames(),
    32      func(name string) ([]byte, error) {
    33        return migrations.Asset(name)
    34      })
    35  
    36    m, err := migrate.NewWithSourceInstance("go-bindata", s, "database://foobar")
    37    m.Up() // run your migrations and handle the errors above of course
    38  }
    39  ```
    40  
    41  
    42  
    43  
    44