Files
ubi-dan-itam/scripts/migrate.ts
toanhoang afdbdbdcfb Initial commit: Next.js scaffold, Request entity, Prisma+Zod, Tailwind v4+shadcn
- Next.js 14 (TS, App Router) monolith
- Request entity (Draft state) via Prisma + Postgres, validated with Zod
- ESLint configured
- Tailwind v4 + shadcn/ui (new-york-v4 style)
- Vitest test suite (6 tests, runs against throwaway Postgres DB per file)
- Multi-agent dev workflow docs in CLAUDE.md and .claude/agents/
2026-07-30 18:14:36 +07:00

17 lines
738 B
TypeScript

// Standalone init/migration entry point: `npm run db:migrate`.
// Prisma Migrate (prisma/migrations) is now the source of truth for the
// schema — this just delegates to `prisma migrate deploy`, which applies
// any pending migrations against DATABASE_URL. Replaces the old
// src/lib/db.ts's manual `CREATE TABLE IF NOT EXISTS` runner.
// Requires DATABASE_URL to point at a reachable Postgres (see
// docker-compose.yml / .env.example).
import { execSync } from "node:child_process";
function main(): void {
execSync("npx prisma migrate deploy", { stdio: "inherit" });
const { host, pathname } = new URL(process.env.DATABASE_URL as string);
console.log(`Migrations applied. Database ready at ${host}${pathname}`);
}
main();