21 lines
393 B
Go
21 lines
393 B
Go
package database
|
|
|
|
import (
|
|
"embed"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
"github.com/pressly/goose/v3"
|
|
)
|
|
|
|
//go:embed migrations/*.sql
|
|
var embedMigrations embed.FS
|
|
|
|
// RunMigrations applies all embedded SQL migrations.
|
|
func RunMigrations(db *sqlx.DB) error {
|
|
goose.SetBaseFS(embedMigrations)
|
|
if err := goose.SetDialect("sqlite3"); err != nil {
|
|
return err
|
|
}
|
|
return goose.Up(db.DB, "migrations")
|
|
}
|