Browse Source

Merge pull request #4900 from nocodb/fix/mariadb-default

fix: MariaDB default value
pull/4910/head
mertmit 2 years ago committed by GitHub
parent
commit
ad042aac59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      packages/nocodb/src/lib/db/sql-client/lib/mysql/MysqlClient.ts

13
packages/nocodb/src/lib/db/sql-client/lib/mysql/MysqlClient.ts

@ -671,6 +671,19 @@ class MysqlClient extends KnexClient {
column.cdf = response[0][i].cdf;
}
// Reference: https://github.com/nocodb/nocodb/issues/4625
// There is an information_schema difference on MariaDB and MySQL
// while MySQL keeps NULL as default value if no value provided
// MariaDB keeps NULL as string (if you provide a string NULL it is wrapped by single-quotes)
// so we check if database is MariaDB and if so we convert the string NULL to null
if (this._version?.version) {
if (this._version.version.includes('Maria')) {
if (column.cdf === 'NULL') {
column.cdf = null;
}
}
}
column.cc = response[0][i].cc;
column.csn = response[0][i].csn;

Loading…
Cancel
Save