add database schema migration for bug reports and users tables
This commit is contained in:
7
main.go
7
main.go
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user