olavim / objection-cursor

Cursor based pagination plugin for Objection.js
MIT License
30 stars 8 forks source link

Doesn't seem to work with knex@2.0.0 #35

Closed cerinoligutom closed 2 years ago

cerinoligutom commented 2 years ago

image

Have a users table with a createdAt field and I'm sorting using that field. Code:

await UserModel.query().orderBy('asc', 'createdAt').limit(10).nextCursorPage(myCursor);

Code works fine on knex@0.95.14 though. I think v1 is also broken as well since I've had a similar issue on one of my repo https://github.com/cerino-ligutom/GraphQL-Starter/issues/27#issuecomment-1065919299 where downgrading to 0.95.14 fixed the issue. I guess knex changed an underlying API that broke this plugin?

olavim commented 2 years ago

Thanks for reporting. I'll try to get this fixed ASAP.

olavim commented 2 years ago

What knex and objection versions are you using? And what database? I tested the following combinations with sqlite:

objection knex status
2.2.18 knex@0.95.14
2.2.18 knex@1.0.7
2.2.18 knex@2.0.0
3.0.1 knex@0.95.14
3.0.1 knex@1.0.7
3.0.1 knex@2.0.0

Note: knex@1.0.7 failed because it depends on an sqlite3 package that no longer exists.

cerinoligutom commented 2 years ago

knex@2.0.0, objection@3.0.1, postgres:13

olavim commented 2 years ago

Can you check if version 1.2.6-alpha.0 fixes the issue for you?

cerinoligutom commented 2 years ago

Hey @olavim, works great! I don't get the error anymore 🎉

olavim commented 2 years ago

Great! Fixed in v1.2.6.

cerinoligutom commented 2 years ago

Thank you for the quick fix! 🚀