add database schema migration for bug reports and users tables

This commit is contained in:
Flavio Fois
2026-03-18 13:04:47 +01:00
parent 2fd89881e7
commit 9df575067a
8 changed files with 321 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import (
"emly-api-go/internal/config"
"emly-api-go/internal/database"
"emly-api-go/internal/database/schema"
"emly-api-go/internal/handlers"
)
@@ -35,6 +36,11 @@ func main() {
}
}(db)
// Run conditional schema migrations
if err := schema.Migrate(db, cfg.Database); err != nil {
log.Fatalf("schema migration failed: %v", err)
}
r := chi.NewRouter()
// Global middlewares
@@ -56,6 +62,7 @@ func main() {
r.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-Server", "emly-api-go")
w.Header().Set("X-Powered-By", "Pure Protogen sillyness :3")
next.ServeHTTP(w, r)
})
})