different approach to migration

This commit is contained in:
Stefan Hardegger
2025-10-20 14:13:45 +02:00
parent 1ee9af8f28
commit 32544d4f4a
2 changed files with 112 additions and 30 deletions

View File

@@ -46,7 +46,7 @@ services:
- library_config:/app/config
depends_on:
postgres:
condition: service_started
condition: service_healthy
solr:
condition: service_started
networks:
@@ -71,35 +71,6 @@ services:
timeout: 5s
retries: 5
migrations:
image: postgres:15-alpine
depends_on:
postgres:
condition: service_healthy
volumes:
- ./backend/create_backup_jobs_table.sql:/migrations/create_backup_jobs_table.sql:ro
networks:
- storycove-network
environment:
- PGPASSWORD=${DB_PASSWORD}
entrypoint: /bin/sh
command: >
-c "
echo '🗄️ Applying database migrations...';
for DB in storycove storycove_afterdark storycove_clas storycove_secret; do
if psql -h postgres -U storycove -lqt | cut -d '|' -f 1 | grep -qw \$$DB; then
echo \" ✓ Applying migration to \$$DB...\";
psql -h postgres -U storycove -d \$$DB -f /migrations/create_backup_jobs_table.sql > /dev/null 2>&1 || true;
fi;
done;
echo '✅ Migrations complete!';
sleep infinity;
"
deploy:
restart_policy:
condition: on-failure
max_attempts: 1
solr:
build: