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.
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.
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.
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 incolumnInfo
for the MySQL dialect, a conditional schema retrieval sql can be generated.Anyone up to the task?