514cd3705f
The single-file bind mount ./scripts/init-db.sh left a stale empty dir in the reused act_runner workspace → mounted as a directory → migrations never ran → empty schemas → backend 28P01/connection failures. Move the init script to deploy/postgres-initdb/00-init.sh and mount the whole DIR at /docker-entrypoint-initdb.d (robust, like the migrations dir). Deploy checkout now 'git clean -ffd' to purge stale workspace dirs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
723 B
Bash
21 lines
723 B
Bash
#!/bin/bash
|
|
# FlatRender V2 — run all schema migrations in order on first postgres init.
|
|
# This whole directory is mounted at /docker-entrypoint-initdb.d (a DIRECTORY mount
|
|
# is robust; a single-file bind mount can leave a stale empty dir in a reused CI
|
|
# workspace → "Is a directory"). Migrations dir mounted read-only at /migrations.
|
|
set -e
|
|
|
|
MIGRATIONS_DIR="/migrations"
|
|
|
|
echo "==> FlatRender: running schema migrations from $MIGRATIONS_DIR"
|
|
|
|
for f in $(ls "$MIGRATIONS_DIR"/*.sql | sort); do
|
|
echo " Applying: $(basename "$f")"
|
|
psql -v ON_ERROR_STOP=1 \
|
|
--username "$POSTGRES_USER" \
|
|
--dbname "$POSTGRES_DB" \
|
|
--file "$f"
|
|
done
|
|
|
|
echo "==> FlatRender: all migrations applied."
|