Files
PolyMPR/databases/docker-init.sh
2026-04-27 00:04:28 +02:00

11 lines
416 B
Bash
Executable File

#!/bin/sh
# Applied by postgres on first container startup via /docker-entrypoint-initdb.d.
# drizzle-kit migration files use "--> statement-breakpoint" markers which are
# not valid SQL — strip them before applying.
set -e
for f in /migrations/*.sql; do
echo "Applying $f..."
sed '/^-->/d' "$f" | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB"
done
echo "All migrations applied."