mariadb default value comatibility changes

closes #153
This commit is contained in:
Kononnable 2019-03-15 13:28:24 +01:00
parent 87690d0547
commit 672a08b4dd
2 changed files with 7 additions and 3 deletions

View File

@ -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)

View File

@ -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}"`;
}