|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import UITypes from '../UITypes'; |
|
|
|
|
import { IDType } from '~/lib'; |
|
|
|
|
import { ColumnType, IDType } from '~/lib'; |
|
|
|
|
|
|
|
|
|
const dbTypes = [ |
|
|
|
|
'int', |
|
|
|
@ -1335,7 +1335,21 @@ export class MysqlUi {
|
|
|
|
|
return ['COUNTA', 'COUNT', 'DATESTR']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static getNowDefaultVal() { |
|
|
|
|
static getCurrentDateDefault(col: Partial<ColumnType>) { |
|
|
|
|
// if database datatype timestamp or datetime then return CURRENT_TIMESTAMP
|
|
|
|
|
if ( |
|
|
|
|
col.dt && |
|
|
|
|
(col.dt.toLowerCase() === 'timestamp' || |
|
|
|
|
col.dt.toLowerCase() === 'datetime') |
|
|
|
|
) { |
|
|
|
|
return 'CURRENT_TIMESTAMP'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// database type is not defined(means column create) and ui datatype is datetime then return CURRENT_TIMESTAMP
|
|
|
|
|
// in this scenario it will create column with datatype timestamp/datetime
|
|
|
|
|
if (!col.dt && col.uidt === UITypes.DateTime) { |
|
|
|
|
return 'CURRENT_TIMESTAMP'; |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|