Skip to content

Commit

Permalink
feat(MySQL Node): Return decimal types as numbers (n8n-io#10313)
Browse files Browse the repository at this point in the history
  • Loading branch information
riascho authored Aug 7, 2024
1 parent bf8f848 commit f744d7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/nodes-base/nodes/MySql/v2/actions/common.descriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ export const optionsCollection: INodeProperties = {
show: { '/operation': ['select', 'executeQuery'] },
},
},
{
displayName: 'Output Decimals as Numbers',
name: 'decimalNumbers',
type: 'boolean',
default: false,
description: 'Whether to output DECIMAL types as numbers instead of strings',
displayOptions: {
show: { '/operation': ['select', 'executeQuery'] },
},
},
{
displayName: 'Priority',
name: 'priority',
Expand Down
5 changes: 5 additions & 0 deletions packages/nodes-base/nodes/MySql/v2/transport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export async function createPool(
password: credentials.password,
multipleStatements: true,
supportBigNumbers: true,
decimalNumbers: false,
};

if (credentials.ssl) {
Expand Down Expand Up @@ -55,6 +56,10 @@ export async function createPool(
connectionOptions.bigNumberStrings = true;
}

if (options?.decimalNumbers === true) {
connectionOptions.decimalNumbers = true;
}

if (!credentials.sshTunnel) {
return mysql2.createPool(connectionOptions);
} else {
Expand Down

0 comments on commit f744d7c

Please sign in to comment.