fix: Prevent unnecessarily touching updatedAt when n8n starts (#5340)
* Include MariaDB in exception list Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <netroy@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { validate as jsonSchemaValidate } from 'jsonschema';
|
||||
import type { INode, IPinData, JsonObject } from 'n8n-workflow';
|
||||
import { NodeApiError, jsonParse, LoggerProxy, Workflow } from 'n8n-workflow';
|
||||
import type { FindOptionsWhere } from 'typeorm';
|
||||
import type { FindOptionsWhere, UpdateResult } from 'typeorm';
|
||||
import { In } from 'typeorm';
|
||||
import pick from 'lodash.pick';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
@@ -459,4 +459,21 @@ export class WorkflowsService {
|
||||
|
||||
return sharedWorkflow.workflow;
|
||||
}
|
||||
|
||||
static async updateWorkflowTriggerCount(id: string, triggerCount: number): Promise<UpdateResult> {
|
||||
const qb = Db.collections.Workflow.createQueryBuilder('workflow');
|
||||
return qb
|
||||
.update()
|
||||
.set({
|
||||
triggerCount,
|
||||
updatedAt: () => {
|
||||
if (['mysqldb', 'mariadb'].includes(config.getEnv('database.type'))) {
|
||||
return 'updatedAt';
|
||||
}
|
||||
return '"updatedAt"';
|
||||
},
|
||||
})
|
||||
.where('id = :id', { id })
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user