diff --git a/CHANGELOG.md b/CHANGELOG.md index 6308542..240b438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,9 @@ * added option to generate models based on multiple databases(#144) * fixed generation of ManyToMany relations on junction tables with custom names(#151) * fixed problems with mysql 8 -* fixed shadowed variables tslint errors( #141) -* fixed generated columns order +* fixed shadowed variables tslint errors(#141) +* fixed order of generated columns +* mariadb default value comatibility changes(#153) ## 0.3.1 * Fixed npx ussage(#146) diff --git a/src/drivers/MysqlDriver.ts b/src/drivers/MysqlDriver.ts index f5623fc..6b4c246 100644 --- a/src/drivers/MysqlDriver.ts +++ b/src/drivers/MysqlDriver.ts @@ -428,9 +428,12 @@ export class MysqlDriver extends AbstractDriver { return ret; } private ReturnDefaultValueFunction(defVal: string | null): string | null { - if (!defVal) { + if (!defVal || defVal === "NULL") { return null; } + if (defVal.toLowerCase() === "current_timestamp()") { + defVal = "CURRENT_TIMESTAMP"; + } if (defVal === "CURRENT_TIMESTAMP" || defVal.startsWith(`'`)) { return `() => "${defVal}"`; }