NULLS LAST in orderBy

I am trying to create a query and the only way i have been able to order by with nulls last

is this:
    const rows = await db
    .select().from(s.webshop)
    .leftJoin(s.searchRank, eq(s.webshop.id, s.searchRank.webshopId))
    .where(and(
        eq(s.webshop.enabled, true),
        eq(s.webshop.disableSeoPage, false).if(onlyFetchIfSeoAllowed)
    ))
    .orderBy(desc(s.searchRank.usage), sql`nulls last`)


so my question is: is there a way to do this without using an escape hatch?
Was this page helpful?