Skip to content

Commit

Permalink
fix(MySQL Node): Node should return date types as strings (#6169)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency committed May 3, 2023
1 parent 3074f42 commit 5d77ec7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/nodes-base/nodes/MySql/MySql.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ export class MySql extends VersionedNodeType {
name: 'mySql',
icon: 'file:mysql.svg',
group: ['input'],
defaultVersion: 2,
defaultVersion: 2.1,
description: 'Get, add and update data in MySQL',
};

const nodeVersions: IVersionedNodeType['nodeVersions'] = {
1: new MySqlV1(baseDescription),
2: new MySqlV2(baseDescription),
2.1: new MySqlV2(baseDescription),
};

super(nodeVersions, baseDescription);
Expand Down
2 changes: 2 additions & 0 deletions packages/nodes-base/nodes/MySql/v2/actions/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
const operation = this.getNodeParameter('operation', 0);
const nodeOptions = this.getNodeParameter('options', 0);

nodeOptions.nodeVersion = this.getNode().typeVersion;

const credentials = await this.getCredentials('mySql');

let sshClient: Client | undefined = undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const versionDescription: INodeTypeDescription = {
name: 'mySql',
icon: 'file:mysql.svg',
group: ['input'],
version: 2,
version: [2, 2.1],
subtitle: '={{ $parameter["operation"] }}',
description: 'Get, add and update data in MySQL',
defaults: {
Expand Down
4 changes: 4 additions & 0 deletions packages/nodes-base/nodes/MySql/v2/transport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export async function createPool(
supportBigNumbers: true,
};

if (options?.nodeVersion && (options.nodeVersion as number) >= 2.1) {
connectionOptions.dateStrings = true;
}

if (options?.connectionLimit) {
connectionOptions.connectionLimit = options.connectionLimit as number;
}
Expand Down

0 comments on commit 5d77ec7

Please sign in to comment.