You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i define the modifiers in my Model and then query it as a relation in another Model, the orderBy is not generated in the final query (with knex.js) while where condition works. I also check the samples provided in your code, i'm writing the same but with 'desc' order! Can you please help ?
// in my relation Model A:
static get modifiers() {
return {
lastSession (builder) {
builder.where('status', '<>', 'CURRENT')
},
orderByTime (builder) {
builder.orderBy('createdAt', 'desc')
}
}
}
in my Model B, i define a HasMany relation with Model A.
Hi @kapouer ,
I've changed my code logic to avoid that modifier, but now i got another issue: ModelA.query().leftJoinRelated('modelB').select(modelA.*, modelB.createdAt as bCreatedAt).orderBy('modelB.createdAt', 'desc')
when i use this kindof query with pagination (objection-cursor), in my second page call, it passed the modelA.createdAt value to my pagination instead of modelB.createdAt based on the knex debug query ( where ([modelB].[created_at] < ?)),
how should i fix it
Hi Team,
when i define the modifiers in my Model and then query it as a relation in another Model, the orderBy is not generated in the final query (with knex.js) while where condition works. I also check the samples provided in your code, i'm writing the same but with 'desc' order! Can you please help ?
in my Model B, i define a HasMany relation with Model A.
then i query Model B with model A:
the result of sessions will always return by id (asc), instead of 'createdAt desc'.
The text was updated successfully, but these errors were encountered: