Closed milovanderlinden closed 4 years ago
Ah, good catch. I forgot to update docker-compose.yml
; it should have:
- ./postgres/schema.sql:/docker-entrypoint-initdb.d/schema.sql
I'll fix this later today.
Is it an option to let golang detect the presence of the database and run migrations?
I'm not a fan of (in-app) migrations. I mostly agree with this article.
Please note docker-compose.yml
in this project is to be used for the dev/local environment only. In a non-local environment postgres/schema.sql
should be run by the server operator, either manually or automated in whatever way fits their platform, i.e. as a k8s task, or as part of a CI/CD pipeline.
I am assuming that create-db.sh is used to generate the database template, but it is missing from the source. However, when in a kubernetes cluster, you may not have access to the database server shell; running scripts on the postgres container should be avoided in my opinion. Is it an option to let golang detect the presence of the database and run migrations?