Fix setup: remove IF NOT EXISTS syntax
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> EOF )
This commit is contained in:
parent
35b0b5b528
commit
4c7535e716
1 changed files with 4 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue