diff --git a/src/app/api/onboarding/route.ts b/src/app/api/onboarding/route.ts index 12d793b..595d201 100644 --- a/src/app/api/onboarding/route.ts +++ b/src/app/api/onboarding/route.ts @@ -25,10 +25,10 @@ export async function POST(request: Request) { const { familyName, memberName, childName, birthDate, sex } = body; try { - // Create family - const familyId = crypto.randomUUID(); + // Check if families table needs tier column + // Try with just basic columns first await sql.unsafe( - `INSERT INTO families (id, name, tier, created_at, updated_at) VALUES ($1, $2, 'free', NOW(), NOW())`, + `INSERT INTO families (id, name, created_at, updated_at) VALUES ($1, $2, NOW(), NOW())`, [familyId, familyName || "The Family"] ); @@ -50,7 +50,7 @@ export async function POST(request: Request) { else if (months >= 3) stage = "infant"; await sql.unsafe( - `INSERT INTO children (id, family_id, name, birth_date, sex, current_stage, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, NOW(), NOW())`, + `INSERT INTO children (id, family_id, name, birth_date, sex, stage, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, NOW(), NOW())`, [childId, familyId, childName, birth.toISOString(), sex, stage] );