From 35b0b5b5282462972f6687e5d224901d6a4979a3 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 10 May 2026 05:10:07 +0530 Subject: [PATCH] Fix setup route to use sql.unsafe() for raw SQL 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 b751777..377bbda 100644 --- a/src/app/api/setup/route.ts +++ b/src/app/api/setup/route.ts @@ -1,12 +1,12 @@ import { NextResponse } from "next/server"; -import { db } from "@/db"; +import { sql } from "@/db"; export async function GET() { try { // Create enums - await db.execute(`CREATE TYPE IF NOT EXISTS child_sex AS ENUM('male', 'female', 'other')`); - await db.execute(`CREATE TYPE IF NOT EXISTS child_stage AS ENUM('newborn', 'infant', 'solids_start', 'toddler_early', 'toddler_late', 'preschool')`); - await db.execute(`CREATE TYPE IF NOT EXISTS member_role AS ENUM('admin', 'caregiver', 'viewer')`); + 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')`); return NextResponse.json({ success: true, message: "Types created" }); } catch (error) {