diff --git a/apps/web/scripts/migrate.ts b/apps/web/scripts/migrate.ts index 71eb8c3..1d49823 100644 --- a/apps/web/scripts/migrate.ts +++ b/apps/web/scripts/migrate.ts @@ -5,13 +5,31 @@ * features we need (pgvector, generated columns), so we manage migration * state ourselves in `_migrations` and apply files as plain SQL. */ +import { existsSync } from "node:fs"; import { readFile, readdir } from "node:fs/promises"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import postgres from "postgres"; const __dirname = dirname(fileURLToPath(import.meta.url)); -const MIGRATIONS_DIR = join(__dirname, "..", "drizzle"); + +// Resolve the migrations directory. Try, in order: +// 1. $MIGRATIONS_DIR env override (explicit deploy-time control) +// 2. `