fix: use Python asyncpg migration runner instead of psql, remove postgresql-client from image

This commit is contained in:
Celes Renata
2026-04-19 22:54:01 +00:00
parent 4d2adaa9e5
commit 47f10cd3cf
3 changed files with 78 additions and 12 deletions
@@ -33,17 +33,7 @@ spec:
- name: run-migrations
image: {{ $root.Values.image.registry }}/{{ $svc.image }}:{{ $root.Values.image.tag }}
imagePullPolicy: {{ $root.Values.image.pullPolicy }}
command: ["sh", "-c"]
args:
- |
for f in $(ls /app/infra/migrations/*.sql 2>/dev/null | sort); do
echo "Applying $(basename $f)..."
PGPASSWORD="$POSTGRES_PASSWORD" psql \
-h "$POSTGRES_HOST" -p "$POSTGRES_PORT" \
-U "$POSTGRES_USER" -d "$POSTGRES_DB" \
-f "$f" -v ON_ERROR_STOP=0 2>&1 | tail -1 || true
done
echo "Migrations complete."
command: ["python", "-m", "services.shared.migrate"]
securityContext:
{{- include "stonks.containerSecurityContext" $root | nindent 12 }}
envFrom: