diff --git a/packages/nocodb-nest/src/db/BaseModelSqlv2.ts b/packages/nocodb-nest/src/db/BaseModelSqlv2.ts index 96be9282d3..96703bea6e 100644 --- a/packages/nocodb-nest/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb-nest/src/db/BaseModelSqlv2.ts @@ -1755,6 +1755,10 @@ class BaseModelSqlv2 { let response; // const driver = trx ? trx : this.dbDriver; + if (this.isPg) { + await this.dbDriver.raw(`SET TIME ZONE 'UTC'`); + } + const query = this.dbDriver(this.tnPath).insert(insertObj); if ((this.isPg || this.isMssql) && this.model.primaryKey) { query.returning( @@ -1889,6 +1893,10 @@ class BaseModelSqlv2 { const prevData = await this.readByPk(id); + if (this.isPg) { + await this.dbDriver.raw(`SET TIME ZONE 'UTC'`); + } + const query = this.dbDriver(this.tnPath) .update(updateObj) .where(await this._wherePk(id)); @@ -2122,6 +2130,10 @@ class BaseModelSqlv2 { // refer : https://www.sqlite.org/limits.html const chunkSize = this.isSqlite ? 10 : _chunkSize; + if (this.isPg) { + await this.dbDriver.raw(`SET TIME ZONE 'UTC'`); + } + const response = this.isPg || this.isMssql ? await this.dbDriver @@ -2168,6 +2180,10 @@ class BaseModelSqlv2 { updatePkValues.push(pkValues); } + if (this.isPg) { + await this.dbDriver.raw(`SET TIME ZONE 'UTC'`); + } + transaction = await this.dbDriver.transaction(); for (const o of toBeUpdated) {