So I created an application that runs in docker containers. For this I also have a postgresql container as database and with every version I expand this database. For this I have new sql files that need to run to create the tables. Only when I try todo this in my docker compose file it never picks up the new scripts. This is my script :
FROM postgres:11.5-alpine
EXPOSE 5432
ENV POSTGRES_USER test
ENV POSTGRES_PASSWORD test
ENV POSTGRES_DB tm
ADD CreateDB.sql /docker-entrypoint-initdb.d/
ADD version200.sql /docker-entrypoint-initdb.d/
ADD version210.sql /docker-entrypoint-initdb.d/
ADD version3.sql /docker-entrypoint-initdb.d/
The last file version3.sql is the newest but this isn't added to the database it won't execute. Do I need todo this in a different way? Or should I just go into the postgresql container? To start the application I use this script:
version: '3.3'
services:
app-db:
build: ./db
ports:
- '5432:5432'
volumes:
- ./data:/var/lib/postgresql/data
app-web:
build: ./web
ports:
- "8080:8080"