Marcel Overdijk
Marcel Overdijk
Explore posts from servers
PPrisma
Created by Marcel Overdijk on 9/12/2024 in #help-and-questions
Order by `rowid`?
Is it possible to order by (SQLite) rowid? I need to order by rowid as my table has no other natural sorting column.
const driverFamilyRelationships = await c.var.f1db.driverFamilyRelationship.findMany({
where: {
AND: [{ driverId: driverId }, pageableQueryOptions.where],
},
orderBy: [
// TODO: { _raw: Prisma.sql`rowid` },
...pageableQueryOptions.orderBy,
],
skip: pageableQueryOptions.skip,
take: pageableQueryOptions.take,
});
const driverFamilyRelationships = await c.var.f1db.driverFamilyRelationship.findMany({
where: {
AND: [{ driverId: driverId }, pageableQueryOptions.where],
},
orderBy: [
// TODO: { _raw: Prisma.sql`rowid` },
...pageableQueryOptions.orderBy,
],
skip: pageableQueryOptions.skip,
take: pageableQueryOptions.take,
});
3 replies
PPrisma
Created by Marcel Overdijk on 4/2/2024 in #help-and-questions
Cursor based pagination without numeric id available in table
When using cursor based pagination (https://www.prisma.io/docs/orm/prisma-client/queries/pagination#cursor-based-pagination) what if a table has no sequential number? Imagine a Person table with an id which is a guid, or maybe just in the format 'firstname-lastname' (like 'vivian-defoe'). And then I would like to do cursor based pagination in combination with an user supplied order (like via a REST api users can provide the sorting option like first_name, last_name, gender, date_of_birth, place_name_of_origin. Is that possible, or should I use offset pagination in that case?
3 replies