adhere to size limits for tables

This commit is contained in:
Vikhyath Mondreti
2026-01-21 17:20:33 -08:00
parent 1938818027
commit be757a4f1e

View File

@@ -104,6 +104,13 @@ export async function POST(request: NextRequest, { params }: UpsertRouteParams)
const now = new Date()
if (!existingRow && table.rowCount >= table.maxRows) {
return NextResponse.json(
{ error: `Table row limit reached (${table.maxRows} rows max)` },
{ status: 400 }
)
}
const upsertResult = await db.transaction(async (trx) => {
if (existingRow) {
const [updatedRow] = await trx