nimblehq / gin-templates

Our optimized Gin templates used in our projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix: Cannot run a project if it does not have any DB migration

malparty opened this issue · comments

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

  1. Generate a new project
  2. Do NOT add any DB migration
  3. Run the project and query http://localhost:8080/api/v1/health
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)
}