CI / quality (push) Waiting to run
- Add lib/db (schema, postgres.js client, enums, seed, migrations) on Drizzle - Rewrite all lib and admin action queries from Prisma to Drizzle - Keep existing table/column names so no data migration is needed - Preserve signed-cookie admin auth unchanged - Map unique-violation handling from Prisma P2002 to SQLSTATE 23505 - Swap deps, scripts, Makefile, and Dockerfile from Prisma to Drizzle
37 lines
648 B
TypeScript
37 lines
648 B
TypeScript
import { sql } from "drizzle-orm";
|
|
import { NextResponse } from "next/server";
|
|
|
|
import { db } from "@/lib/db";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET() {
|
|
const timestamp = new Date().toISOString();
|
|
|
|
try {
|
|
await db.execute(sql`SELECT 1`);
|
|
|
|
return NextResponse.json(
|
|
{
|
|
status: "ok",
|
|
timestamp,
|
|
checks: {
|
|
database: "up",
|
|
},
|
|
},
|
|
{ status: 200 },
|
|
);
|
|
} catch {
|
|
return NextResponse.json(
|
|
{
|
|
status: "degraded",
|
|
timestamp,
|
|
checks: {
|
|
database: "down",
|
|
},
|
|
},
|
|
{ status: 503 },
|
|
);
|
|
}
|
|
}
|