vegapokerbot/internal/db/migrations/init.go
2024-05-07 21:49:09 +03:00

29 lines
461 B
Go

package migrations
import (
"embed"
"github.com/golang-migrate/migrate/v4/source"
"github.com/golang-migrate/migrate/v4/source/httpfs"
"net/http"
)
//go:embed *.sql
var static embed.FS
func init() {
source.Register("embed", &driver{})
}
type driver struct {
httpfs.PartialDriver
}
func (d *driver) Open(rawURL string) (source.Driver, error) {
err := d.PartialDriver.Init(http.FS(static), ".")
if err != nil {
return nil, err
}
return d, nil
}