-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bookshelf & Knex upgrade #6103
Comments
Really need this, with a non-perfect PG connection, current version of |
refs: TryGhost#6103 - dependency upgrade only, code changes to follow
The library updates are done, but none of the code changes / potential improvements are done yet. |
Bookshelf 0.9.5 (merged by #6836) has its own pagination plugin (finally!) it may be worth looking at dropping ours in favour of theirs. |
Can close this. Bookshelf is actively maintained again, and at some point we'll look into catching up again. When we do, this information is here. Right now the built in |
refs #6103 - simplify `toJSON` - `baseKey` was not used - have not find a single use case - all the functionality of our `toJSON` is offered in bookshelf - `omitPivot` does remove pivot elements from the JSON obj (bookshelf feature) - `shallow` allows you to not return relations - make use of `serialize`, see http://bookshelfjs.org/docs/src_base_model.js.html#line260 - fetching nested relations e.g. `users.roles` still works (unrelated to this refactoring) > pick('shallow', 'baseKey', 'include', 'context') We will re-add options validation in #9427, but then with the official way: use `filterOptions`. --- We return all fetched relations (pre-defined with `withRelated`) by default. You can disable it with `shallow:true`.
Bookshelf & knex did not get upgraded at the start of this release cycle. This was because there was a reasonable amount of work to do, and I got carried away with other work before I completed it. I very much regret this, as several of the filter, include, etc features I've been building into our model layer would have been simpler had I had access to the newer features.
I did try out upgrading to [email protected] & [email protected], it did not cause any test regressions (and iirc I ran the old casper.js test suite against this). The current versions are [email protected] and [email protected], and so there's been another significant update which warrants testing.
At the start of the next release cycle, I want to get this upgrade done ASAP. I'll be using this issue to document everything that I know can or needs to be changed as a result of the upgrade.
toJSON
. It should be possible to use the new structure to overrideserialize
instead oftoJSON
in places in our codebase, and simplify our code.countDistinct
method we can use to replace some horribleknex.raw
code in the pagination plugin (should be in knex 0.9.1)Even newer:
fetchPage
method that we can use instead of our own.Things to be aware of:
The text was updated successfully, but these errors were encountered: