Fix setup: remove IF NOT EXISTS syntax

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)
This commit is contained in:
Manohar Gupta 2026-05-10 05:11:52 +05:30
parent 35b0b5b528
commit 4c7535e716

View file

@ -3,10 +3,10 @@ import { sql } from "@/db";
export async function GET() { export async function GET() {
try { try {
// Create enums // Create enums one at a time
await sql.unsafe(`CREATE TYPE IF NOT EXISTS child_sex AS ENUM('male', 'female', 'other')`); await sql.unsafe("CREATE TYPE child_sex AS ENUM('male', 'female', 'other')").catch(() => {});
await sql.unsafe(`CREATE TYPE IF NOT EXISTS child_stage AS ENUM('newborn', 'infant', 'solids_start', 'toddler_early', 'toddler_late', 'preschool')`); await sql.unsafe("CREATE TYPE child_stage AS ENUM('newborn', 'infant', 'solids_start', 'toddler_early', 'toddler_late', 'preschool')").catch(() => {});
await sql.unsafe(`CREATE TYPE IF NOT EXISTS member_role AS ENUM('admin', 'caregiver', 'viewer')`); await sql.unsafe("CREATE TYPE member_role AS ENUM('admin', 'caregiver', 'viewer')").catch(() => {});
return NextResponse.json({ success: true, message: "Types created" }); return NextResponse.json({ success: true, message: "Types created" });
} catch (error) { } catch (error) {