Question Regarding Optimistic concurrency control ...
# orm-help
l
Question Regarding Optimistic concurrency control https://www.prisma.io/docs/guides/performance-and-optimization/prisma-client-transactions-guide#when-to-use-optimistic-concurrency-control Is there a reason not to use a column
updatedAt  DateTime @updatedAt
instead of the in the docs mentioned
version
column? The code would then look like this:
Copy code
const availableSeat = await client.seat.findFirst({
  where: {
    Movie: {
      name: movieName,
    },
    claimedBy: null,
  },
})

if (!availableSeat) {
  throw new Error(`Oh no! ${movieName} is all booked.`)
}

const seats = await client.seat.updateMany({
  data: {
    claimedBy: userEmail,
  },
  where: {
    id: availableSeat.id,
    updatedAt: availableSeat.updatedAt,
  },
})