Fix schema columns
This commit is contained in:
parent
e4b2019325
commit
92878a6bd9
1 changed files with 4 additions and 4 deletions
|
|
@ -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]
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue