Skip to content
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

Add support for mysql/mariadb-client JSON parameters in connectionURIs #4629

Merged
merged 5 commits into from Aug 30, 2021

Conversation

petetnt
Copy link
Contributor

@petetnt petetnt commented Aug 20, 2021

This PR fixes #4628 by adding support for parsing JSON-like URL parameters for mysql/mariadb-clients (mysqljs/mysql, node-mysql2)

@kibertoad
Copy link
Collaborator

Thanks! Can you also add a very simple integration test that would ensure MySQL actually works when such connection params are passed to it?

@petetnt
Copy link
Contributor Author

petetnt commented Aug 27, 2021

Hi @kibertoad!

Sorry for the late response, busy week... I added integration tests in petetnt@550eaab

Added them to integration2/mysql2.spec.js as it seemed the most appropriate place, but don't know if it is the correct place.

As SSL settings require quite a lot of effort to get running locally, I opted for using rejectUnauthorized as a test case (documented in https://github.com/mysqljs/mysql#ssl-options). Additionally I added a test to ensure that passing a string as the profile still works (ssl=Amazon RDS would also work, but it will throw with self signed certificates in signature chain error when running regardless).

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
@kibertoad
Copy link
Collaborator

@petetnt CI is failing, unfortunately.

@petetnt
Copy link
Contributor Author

petetnt commented Aug 28, 2021 via email

@kibertoad
Copy link
Collaborator

@petetnt There is docker-compose config available for all the dbs, check scripts in package.json

@petetnt
Copy link
Contributor Author

petetnt commented Aug 28, 2021

I was using that, I meant that eg. mysql doesn't have an ARM64 build at all, so one needs to specify platform: linux/x86_64 on the docker-compose file etc. to pull those images and run them with Rosetta and so on.

The failing test is


  Failed Tests: There were 2 failures

    #4628, supports mysql / mariadb client JSON parameters

      ✖ should be loosely deeply equivalent
      ✖ should be loosely deeply equivalent

I think that the prettier fixing removing those "extra" /s as unnecessary escapes broke the equivalency checks there, should be an easy fix when I get pack to my computer 👍

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
@petetnt
Copy link
Contributor Author

petetnt commented Aug 30, 2021

The actual issue was port 0000 being parsed to 0, which was fixed in 4fda93e :)

@kibertoad kibertoad merged commit 49b05b5 into knex:master Aug 30, 2021
OlivierCavadenti pushed a commit to AbeonaPascha/knex that referenced this pull request Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Knex doesn't parse JSON values in connectionURIs causing incompatibility with mysql / node-mysql2
2 participants