From 4c7535e71616836d037a1082b1062e03d7f57ef6 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 10 May 2026 05:11:52 +0530 Subject: [PATCH] Fix setup: remove IF NOT EXISTS syntax Co-Authored-By: Claude Opus 4.7 EOF ) --- src/app/api/setup/route.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/api/setup/route.ts b/src/app/api/setup/route.ts index 377bbda..fb8494c 100644 --- a/src/app/api/setup/route.ts +++ b/src/app/api/setup/route.ts @@ -3,10 +3,10 @@ import { sql } from "@/db"; export async function GET() { try { - // Create enums - await sql.unsafe(`CREATE TYPE IF NOT EXISTS child_sex AS ENUM('male', 'female', 'other')`); - 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 IF NOT EXISTS member_role AS ENUM('admin', 'caregiver', 'viewer')`); + // Create enums one at a time + await sql.unsafe("CREATE TYPE child_sex AS ENUM('male', 'female', 'other')").catch(() => {}); + await sql.unsafe("CREATE TYPE child_stage AS ENUM('newborn', 'infant', 'solids_start', 'toddler_early', 'toddler_late', 'preschool')").catch(() => {}); + await sql.unsafe("CREATE TYPE member_role AS ENUM('admin', 'caregiver', 'viewer')").catch(() => {}); return NextResponse.json({ success: true, message: "Types created" }); } catch (error) {