feature: move schema updates into a separate oneshot service
This commit is contained in:
parent
de51bd9015
commit
a8bcde76e2
4 changed files with 198 additions and 12 deletions
|
@ -25,8 +25,6 @@ import (
|
|||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
"github.com/uabluerail/indexer/pds"
|
||||
"github.com/uabluerail/indexer/repo"
|
||||
"github.com/uabluerail/indexer/util/gormzerolog"
|
||||
)
|
||||
|
||||
|
@ -55,16 +53,6 @@ func runMain(ctx context.Context) error {
|
|||
}
|
||||
log.Debug().Msgf("DB connection established")
|
||||
|
||||
for _, f := range []func(*gorm.DB) error{
|
||||
pds.AutoMigrate,
|
||||
repo.AutoMigrate,
|
||||
} {
|
||||
if err := f(db); err != nil {
|
||||
return fmt.Errorf("auto-migrating DB schema: %w", err)
|
||||
}
|
||||
}
|
||||
log.Debug().Msgf("DB schema updated")
|
||||
|
||||
lister, err := NewLister(ctx, db)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create lister: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue