(trx: DbTransaction, tableId: string, position: number)
| 85 | |
| 86 | /** Shifts every row after `position` down by one (`position - 1`). */ |
| 87 | export 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. |
no test coverage detected