/** * Apply committed migrations to DATABASE_URL — for a local database only. * On the box, the deploy pipeline applies them (loki's apply-schema.sh). */ import { drizzle } from "drizzle-orm/node-postgres"; import { migrate } from "drizzle-orm/node-postgres/migrator"; import { Pool } from "pg"; const url = process.env.DATABASE_URL; if (!url) throw new Error("DATABASE_URL is not set"); const pool = new Pool({ connectionString: url }); await migrate(drizzle(pool), { migrationsFolder: "drizzle" }); await pool.end(); console.log("migrations applied");