Fix: Cannot run a project if it does not have any DB migration
malparty opened this issue · comments
Xavier MALPARTY commented
Issue
When scaffolding a new project, the api/v1/health
route shoud work, even if we have not added any DB migration yet. Currently, the endpoint return 403 ERR_CONNECTION_REFUSED
because the app does not start properly (see log FATA[0000] Failed to migrate database: no migration files found
).
Expected
A freshly generated project has the endpoint /api/v1/health
that returns the 200 OK
status code.
Steps to reproduce
- Generate a new project
- Do NOT add any DB migration
- Run the project and query
http://localhost:8080/api/v1/health
Mark G commented
Should we just print the log instead of throwing a fatal error?
err = goose.Up(sqlDB, "database/migrations", goose.WithAllowMissing())
if err != nil {
log.Println(err)
}