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 MariaDB detection and compatibility #109

Open
gpetrov opened this issue Apr 25, 2022 · 0 comments
Open

Add MariaDB detection and compatibility #109

gpetrov opened this issue Apr 25, 2022 · 0 comments

Comments

@gpetrov
Copy link

gpetrov commented Apr 25, 2022

Currently MariaDB knex connections are processed done with the MySQL driver and use the MySQL dialect.
This is all fine for the most cases, however more and more differences emerge between MySQL and MariaDB.

For example, database column DEFAULT values are quoted starting from MariaDB 10.2.7, see https://mariadb.com/kb/en/information-schema-columns-table/ while in MySQL they are not.

Furthermore in MariaDB the JSON data type doesn't existing, it is merely an alias that results in LONGTEXT data type for the JSON column. The columnInfo function doesn't detect it. See https://mariadb.com/kb/en/json-data-type/ - The LONGTEXT is created with a special CHECK constrain that validates the JSON, so an additional SQL needs to be added specially for MariaDB to fetch this constrain and detect that it is a JSON field.

Other possible differences are listed here:
https://mariadb.com/kb/en/incompatibilities-and-feature-differences-between-mariadb-104-and-mysql-80/

So maybe the knex-schema-inspector should do some db version detection on init and when MariaDB is detected, additional SQL commands can be added to retrieve extra information. Like executing first SELECT VERSION() and then setting some flags if it is MariaDB and what version, so that later on in columnInfo for the MySQL dialect, a conditional schema retrieval sql can be generated.

Anyone up to the task?

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

No branches or pull requests

1 participant