Fix setup route to use sql.unsafe() for raw SQL
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> EOF )
This commit is contained in:
parent
8ca54fec30
commit
35b0b5b528
1 changed files with 4 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue