Added embedder support (currently broken upstream).
This commit is contained in:
parent
76f65aac90
commit
de6ea75756
1 changed files with 15 additions and 3 deletions
|
|
@ -4,9 +4,11 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.destrealm.net/zancarius/justusbot/internal/app"
|
||||
"code.destrealm.net/zancarius/justusbot/internal/models"
|
||||
"code.destrealm.net/zancarius/justusbot/internal/settings"
|
||||
"github.com/urfave/cli/v3"
|
||||
"go.destrealm.net/embedder"
|
||||
"go.destrealm.net/errors"
|
||||
"go.destrealm.net/logging/v3"
|
||||
"go.destrealm.net/vfs"
|
||||
|
|
@ -27,10 +29,20 @@ func initInstaller(fs vfs.VFS, settings *settings.Settings) (*installer, error)
|
|||
}
|
||||
|
||||
func (inst *installer) DoInstall(ctx context.Context, cmd *cli.Command) error {
|
||||
fmt.Println(inst.settings)
|
||||
// Embedder needs examining. It seems that it doesn't support correctly
|
||||
// listing directories, possibly due to changes since Golang 1.16.
|
||||
//
|
||||
// This code is being added here to support embedded migrations in the
|
||||
// future.
|
||||
efs := embedder.NewEmbedderVFS(app.LoadBucket("migrations"))
|
||||
|
||||
lfs := vfs.NewLayeredFS()
|
||||
lfs.AddFS(efs)
|
||||
lfs.AddFS(inst.fs)
|
||||
|
||||
db := models.OpenDatabase(inst.settings)
|
||||
fmt.Println(inst.settings.System.DSN)
|
||||
err := db.Migrate(inst.fs)
|
||||
fmt.Println("migrated database:", inst.settings.System.DSN)
|
||||
err := db.Migrate(lfs)
|
||||
if err != nil {
|
||||
inst.logger.Error(errors.Unfurl(err))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue