I switched to v2 this morning and got the following error in my error handler middleware:
TS2305: Module '"../../node_modules/objection/typings/objection"' has no exported member 'NotNullViolationError'.
I checked the typings file, NotNullViolationError really does not exist there.
Fix: NotNullViolationError originates from db-errors so a simple export in typings file will fix the issue.