Update tern for migrations to v2
Tern v2 uses pgx
v5 internally, the same as we are using in our code.
As far as I can tell, the changelog does not mention any breaking changes that would affect us: https://github.com/jackc/tern#200-february-23-2023
This MR is a preparation for !42 (merged)
Edited by Jack Henschel