Browse Source

Merge pull request #7551 from nocodb/fix/7550-row-creation-mariadb

fix: Use correct datetime format based on current source(datasource)
pull/7556/head
Mert E 9 months ago committed by GitHub
parent
commit
b84c3575cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      packages/nocodb/src/db/BaseModelSqlv2.ts

12
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -5763,7 +5763,7 @@ class BaseModelSqlv2 {
); );
if (lastModifiedTimeColumn) { if (lastModifiedTimeColumn) {
updateObject[lastModifiedTimeColumn.column_name] = Noco.ncMeta.now(); updateObject[lastModifiedTimeColumn.column_name] = this.now();
} }
if (lastModifiedByColumn) { if (lastModifiedByColumn) {
@ -5798,13 +5798,13 @@ class BaseModelSqlv2 {
if (column.system) { if (column.system) {
if (isInsertData) { if (isInsertData) {
if (column.uidt === UITypes.CreatedTime) { if (column.uidt === UITypes.CreatedTime) {
data[column.column_name] = Noco.ncMeta.now(); data[column.column_name] = this.now();
} else if (column.uidt === UITypes.CreatedBy) { } else if (column.uidt === UITypes.CreatedBy) {
data[column.column_name] = cookie?.user?.id; data[column.column_name] = cookie?.user?.id;
} }
} }
if (column.uidt === UITypes.LastModifiedTime) { if (column.uidt === UITypes.LastModifiedTime) {
data[column.column_name] = isInsertData ? null : Noco.ncMeta.now(); data[column.column_name] = isInsertData ? null : this.now();
} else if (column.uidt === UITypes.LastModifiedBy) { } else if (column.uidt === UITypes.LastModifiedBy) {
data[column.column_name] = isInsertData ? null : cookie?.user?.id; data[column.column_name] = isInsertData ? null : cookie?.user?.id;
} }
@ -5946,6 +5946,12 @@ class BaseModelSqlv2 {
} }
} }
} }
public now() {
return dayjs()
.utc()
.format(this.isMySQL ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ');
}
} }
export function extractSortsObject( export function extractSortsObject(

Loading…
Cancel
Save