Merge branch 'dev/post-reports' of git.anthrove.art:Anthrove/otter-space-sdk into dev/post-reports
All checks were successful
Gitea Build Check / Build (pull_request) Successful in 2m57s
Gitea Build Check / Build (push) Successful in 2m58s

This commit is contained in:
SoXX 2024-11-06 12:22:27 +01:00
commit 18a68b452f
3 changed files with 7 additions and 3 deletions

View File

@ -70,10 +70,12 @@ func Connect(ctx context.Context, config models.DatabaseConfig) error {
return utils.HandleError(ctx, span, localLogger, err) return utils.HandleError(ctx, span, localLogger, err)
} }
if config.Migrate {
err = migrateDatabase(ctx, sqlDB, config) err = migrateDatabase(ctx, sqlDB, config)
if err != nil { if err != nil {
return utils.HandleError(ctx, span, localLogger, err) return utils.HandleError(ctx, span, localLogger, err)
} }
}
client = sqlDB client = sqlDB
utils.HandleEvent(span, localLogger, "Database connected successfully") utils.HandleEvent(span, localLogger, "Database connected successfully")

View File

@ -9,4 +9,5 @@ type DatabaseConfig struct {
SSL bool `env:"DB_SSL,required" envDefault:"true"` SSL bool `env:"DB_SSL,required" envDefault:"true"`
Timezone string `env:"DB_TIMEZONE,required" envDefault:"Europe/Berlin"` Timezone string `env:"DB_TIMEZONE,required" envDefault:"Europe/Berlin"`
Debug bool `env:"DB_DEBUG" envDefault:"false"` Debug bool `env:"DB_DEBUG" envDefault:"false"`
Migrate bool
} }

View File

@ -121,6 +121,7 @@ func DatabaseModesFromConnectionString(ctx context.Context, pgContainer *postgre
SSL: false, SSL: false,
Timezone: "Europe/Berlin", Timezone: "Europe/Berlin",
Debug: true, Debug: true,
Migrate: true,
} }
return databaseConfig, nil return databaseConfig, nil