Skip to content

Commit be757a4

Browse files
committed
adhere to size limits for tables
1 parent 1938818 commit be757a4

File tree

1 file changed

+7
-0
lines changed
  • apps/sim/app/api/table/[tableId]/rows/upsert

1 file changed

+7
-0
lines changed

apps/sim/app/api/table/[tableId]/rows/upsert/route.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ export async function POST(request: NextRequest, { params }: UpsertRouteParams)
104104

105105
const now = new Date()
106106

107+
if (!existingRow && table.rowCount >= table.maxRows) {
108+
return NextResponse.json(
109+
{ error: `Table row limit reached (${table.maxRows} rows max)` },
110+
{ status: 400 }
111+
)
112+
}
113+
107114
const upsertResult = await db.transaction(async (trx) => {
108115
if (existingRow) {
109116
const [updatedRow] = await trx

0 commit comments

Comments
 (0)