MCPcopy Index your code
hub / github.com/simstudioai/sim / shiftRowsDownAfter

Function shiftRowsDownAfter

apps/sim/lib/table/rows/ordering.ts:87–92  ·  view source on GitHub ↗
(trx: DbTransaction, tableId: string, position: number)

Source from the content-addressed store, hash-verified

85
86/** Shifts every row after `position` down by one (`position - 1`). */
87export async function shiftRowsDownAfter(trx: DbTransaction, tableId: string, position: number) {
88 await trx
89 .update(userTableRows)
90 .set({ position: sql`position - 1` })
91 .where(and(eq(userTableRows.tableId, tableId), gt(userTableRows.position, position)))
92}
93
94/**
95 * Reserves the `position` for a single inserted row and returns where to INSERT.

Callers 1

deleteOrderedRowFunction · 0.85

Calls 2

setMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected