Closed andy-hayes1 closed 4 years ago
We can tell it by the existence of clearContext
method. It has been introduced in the very same commit. See https://github.com/Vincit/objection.js/commit/9c9b25569e99ac3fd26d58791a7720d6d608c074#diff-8f266653ab055c494b98c08438ab98f8R95 . Will make a PR in a sec.
Good idea. Or maybe if somehow we can tell if the
builder
comes from v1 or v2, then we could just usecontext
/mergeContext
depending on which Objection version we're at. Maybe by the existence oftoSql
method ( https://vincit.github.io/objection.js/release-notes/migration.html#querybuilder-tostring-and-querybuilder-tosql-have-been-removed ). Or some method that has been introduced in v2 but didn't exist in v1.