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

Replace mysql client with mysql2 #22534

Merged
merged 17 commits into from
Jun 14, 2024
Merged

Replace mysql client with mysql2 #22534

merged 17 commits into from
Jun 14, 2024

Conversation

paescuj
Copy link
Member

@paescuj paescuj commented May 21, 2024

Scope

Replace the database client library mysql with mysql2, which is a continuation of the former. The client is used to connect to MySQL/MariaDB databases.

Besides mysql2 being actively maintained, it also promises better performance along with additional features.
Switching to mysql2 enables using MySQL without the mysql_native_password authentication plugin, deprecated in MySQL 8.0.34 1. mysql2 is a drop in replacement for mysql, with two known incompatibilities 2 (see below).

Potential Risks / Drawbacks

As mentioned in the breaking changes:

  • mysql2 leads to cross-collection queries (filtering on relations) with stricter charset comparison, meaning the value of DB_CHARSET/DB_CHARSET_NUMBER needs to match the charset of the tables to work properly. This has already been recommended before and a corresponding warning in the server log has already been in place.
  • Values of type "Decimal" are now returned as a string instead of a number, which ensures that the precision is preserved. This matches the behavior of PostgreSQL.

Review Notes / Questions

As you can see in https://github.com/directus/directus/actions/runs/9478259269, the blackbox tests are successful (only the checks fail, which are generally an issue at the moment)


Closes #19361, related to #20502

Footnotes

  1. https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-34.html

  2. https://sidorares.github.io/node-mysql2/docs/documentation#known-incompatibilities-with-node-mysql

Copy link

changeset-bot bot commented May 21, 2024

🦋 Changeset detected

Latest commit: 178ee40

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@directus/api Major
directus Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@paescuj paescuj marked this pull request as ready for review June 12, 2024 07:10
@rijkvanzanten rijkvanzanten changed the base branch from main to v11-rc June 14, 2024 19:17
@rijkvanzanten rijkvanzanten merged commit 6bd3dee into v11-rc Jun 14, 2024
1 check passed
@rijkvanzanten rijkvanzanten deleted the mysql2 branch June 14, 2024 19:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace mysql with mysql2
3 participants