db migration
This commit is contained in:
@@ -66,6 +66,34 @@ services:
|
||||
networks:
|
||||
- storycove-network
|
||||
|
||||
migrations:
|
||||
image: postgres:15-alpine
|
||||
depends_on:
|
||||
- postgres
|
||||
volumes:
|
||||
- ./backend/create_backup_jobs_table.sql:/migrations/create_backup_jobs_table.sql:ro
|
||||
networks:
|
||||
- storycove-network
|
||||
entrypoint: /bin/sh
|
||||
command: >
|
||||
-c "
|
||||
echo 'Waiting for postgres to be ready...';
|
||||
sleep 5;
|
||||
echo 'Applying migrations to all databases...';
|
||||
for DB in storycove storycove_afterdark storycove_clas storycove_secret; do
|
||||
echo \"Checking if database \$$DB exists...\";
|
||||
if PGPASSWORD=${DB_PASSWORD} psql -h postgres -U storycove -lqt | cut -d \\| -f 1 | grep -qw \$$DB; then
|
||||
echo \"Applying migration to \$$DB...\";
|
||||
PGPASSWORD=${DB_PASSWORD} psql -h postgres -U storycove -d \$$DB -f /migrations/create_backup_jobs_table.sql;
|
||||
echo \"✓ Migration applied to \$$DB\";
|
||||
else
|
||||
echo \"⚠ Database \$$DB does not exist, skipping...\";
|
||||
fi;
|
||||
done;
|
||||
echo 'All migrations complete!';
|
||||
"
|
||||
restart: "no"
|
||||
|
||||
|
||||
solr:
|
||||
build:
|
||||
|
||||
Reference in New Issue
Block a user