tsx@4.21.0 + Node.js v22 has two unfixable interop bugs: - --import tsx/esm hook: importSyncForRequire fails on @/ path aliases - tsx runner: @next/env has __esModule:true but no .default export → TypeError Solution: run SQL migrations directly via psql (alpine + postgresql-client). All migration files use IF NOT EXISTS guards so they're idempotent on re-run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
605 B
Text
15 lines
605 B
Text
# 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'"]
|