knex icon indicating copy to clipboard operation
knex copied to clipboard

Explicit jsonb support for custom pg clients

Open viqueen opened this issue 2 years ago • 6 comments

I ran into an issue where my jsonb columns are created as text when using pg-mem in tests and aurora friendly clients like knex-data-api-client

It resulted in a lot of cast blah as jsonb workarounds, but really, the issue is that under the hood, knex just falls back to text data type when it cannot resolve a valid pg version.

This change lets custom clients like knex-data-api explicitly state they support jsonb instead of passing in a potentially wrong postgres version (think serverless setup)

viqueen avatar May 30 '22 12:05 viqueen

Coverage Status

Coverage increased (+0.06%) to 92.284% when pulling 7ca0f2fed0c27c2edf2803df3ed91e08b79fb49e on viqueen:issue/PYN-1078-explicit-jsonb-support-for-custom-pg-clients into 8a50dd7462d40cfa122a233f7fcada24ea39d3ae on knex:master.

coveralls avatar May 30 '22 12:05 coveralls

Ready for review ?

OlivierCavadenti avatar Jun 04 '22 12:06 OlivierCavadenti

@OlivierCavadenti it's ready , though I think I should leave the check on cockroachdb client in place to avoid breaking somebody's world

viqueen avatar Jun 07 '22 08:06 viqueen

@viqueen Can you also add integration test for this?

kibertoad avatar Jun 07 '22 08:06 kibertoad

Documentation needs to be added here: https://github.com/knex/documentation/pulls

kibertoad avatar Jun 09 '22 11:06 kibertoad

@kibertoad documentation added over here https://github.com/knex/documentation/pull/423 I added a unit test only. a meaningful integration test would be with a serverless db like aurora postgres, I'm thinking to wire it up with localstack, but can't sink more time this week. unit test sounds like a good middle ground for now , what do you think ?

viqueen avatar Jun 14 '22 07:06 viqueen

and another ping @kibertoad , is there more to do documentation wise ? I've already opened this https://github.com/knex/documentation/pull/423 , but it's also not reviewed yet

viqueen avatar Aug 26 '22 06:08 viqueen

sorry for the delay, I was swamped a bit will take a look over the weekend

kibertoad avatar Aug 26 '22 11:08 kibertoad

unit test sounds like a good middle ground for now , what do you think ?

sure, let's go with a unit test

kibertoad avatar Aug 26 '22 11:08 kibertoad

Released in 2.3.0

kibertoad avatar Aug 31 '22 19:08 kibertoad