different approach to migration
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user