Skip to content

Commit

Permalink
feat: simplify migration by removing templating
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Oct 17, 2024
1 parent 397327a commit e27b872
Show file tree
Hide file tree
Showing 36 changed files with 416 additions and 428 deletions.
16 changes: 2 additions & 14 deletions internal/storage/bucket/migrations.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package bucket

import (
"bytes"
"context"
"embed"
"go.opentelemetry.io/otel/trace"
"text/template"

"github.com/formancehq/go-libs/v2/migrations"
"github.com/uptrace/bun"
"go.opentelemetry.io/otel/trace"
)

//go:embed migrations
Expand All @@ -18,16 +15,7 @@ func GetMigrator(name string) *migrations.Migrator {

migrator := migrations.NewMigrator(migrations.WithSchema(name, true))
migrator.RegisterMigrationsFromFileSystem(migrationsDir, "migrations", func(s string) string {
buf := bytes.NewBufferString("")

t := template.Must(template.New("migration").Parse(s))
if err := t.Execute(buf, map[string]any{
"Bucket": name,
}); err != nil {
panic(err)
}

return buf.String()
return s
})

return migrator
Expand Down
Loading

0 comments on commit e27b872

Please sign in to comment.