feat: wire growth report API and worker

This commit is contained in:
2026-08-21 00:43:43 +03:30
parent d4265b662f
commit bb4a85cd65
4 changed files with 75 additions and 20 deletions

View File

@@ -25,14 +25,16 @@ func main() {
os.Exit(1)
}
defer pool.Close()
migration, err := os.ReadFile("migrations/000001_mvp.sql")
if err != nil {
logger.Error("reading migration failed", "error", err)
os.Exit(1)
for _, path := range []string{"migrations/000001_mvp.sql", "migrations/000002_growth_analyst.sql"} {
migration, err := os.ReadFile(path)
if err != nil {
logger.Error("reading migration failed", "path", path, "error", err)
os.Exit(1)
}
if err := database.Migrate(ctx, pool, string(migration)); err != nil {
logger.Error("migration failed", "path", path, "error", err)
os.Exit(1)
}
}
if err := database.Migrate(ctx, pool, string(migration)); err != nil {
logger.Error("migration failed", "error", err)
os.Exit(1)
}
logger.Info("migration complete", "version", 1)
logger.Info("migration complete", "version", 2)
}