# syntax=docker/dockerfile:1 # Migrator — runs SQL migration files via psql. # Bypasses tsx/Node.js v22 importSyncForRequire + @next/env interop bugs. # All migrations must be idempotent SQL (use IF NOT EXISTS / ADD COLUMN IF NOT EXISTS). FROM alpine:3 RUN apk add --no-cache postgresql-client WORKDIR /migrations COPY migrations/ . CMD ["sh", "-c", "\ for f in $(ls -v *.sql 2>/dev/null); do \ echo \"→ $f\"; \ psql \"$DATABASE_URL\" -v ON_ERROR_STOP=0 -f \"$f\" && echo \"✓ $f\" || echo \"⚠ $f (errors ignored — likely already applied)\"; \ done; \ echo '✓ migrations done'"]