make FS optional and actually call goose.SetBaseFS
This commit is contained in:
@@ -95,9 +95,6 @@ func ModuleMigrations(cfg MigrationOpts) *app.Module {
|
|||||||
if cfg.BasePath == "" {
|
if cfg.BasePath == "" {
|
||||||
cfg.BasePath = "." // default base path if not set
|
cfg.BasePath = "." // default base path if not set
|
||||||
}
|
}
|
||||||
if cfg.FS == nil {
|
|
||||||
panic("Migration filesystem (FS) must be set in the configuration")
|
|
||||||
}
|
|
||||||
|
|
||||||
migrationsConfig = cfg // store configuration at package level
|
migrationsConfig = cfg // store configuration at package level
|
||||||
|
|
||||||
@@ -136,6 +133,9 @@ func setupMigrations(_ *app.Module) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set base filesystem for goose migrations
|
||||||
|
goose.SetBaseFS(migrationsConfig.FS)
|
||||||
|
|
||||||
// Initialize the goose migration provider
|
// Initialize the goose migration provider
|
||||||
Migration, err = goose.NewProvider(migrationsConfig.Dialect, migrationsConfig.SQLO(), migrationsConfig.FS)
|
Migration, err = goose.NewProvider(migrationsConfig.Dialect, migrationsConfig.SQLO(), migrationsConfig.FS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user