fix: remove extra options to mysql2 pool

Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
This commit is contained in:
Muhammad Aaqil 2024-01-14 11:28:55 +05:00
parent be9c2f173c
commit dcea851121
1 changed files with 26 additions and 1 deletions

View File

@ -108,6 +108,28 @@ MySQL.prototype.connect = function(callback) {
function generateOptions(settings) { function generateOptions(settings) {
const s = settings || {}; const s = settings || {};
const generatorSpecificOptions = [
'name',
'connector',
'sharedData',
'forwardErrorToEnvironment',
'skipLocalCache',
'_',
'c',
'y',
'initialGenerator',
'resolved',
'namespace',
'skip-cache',
'skip-install',
'force-install',
'ask-answered',
'config',
'yes',
'url',
'engine',
'collation',
];
if (s.collation) { if (s.collation) {
// Charset should be first 'chunk' of collation. // Charset should be first 'chunk' of collation.
s.charset = s.collation.substr(0, s.collation.indexOf('_')); s.charset = s.collation.substr(0, s.collation.indexOf('_'));
@ -148,7 +170,10 @@ function generateOptions(settings) {
// Take other options for mysql driver // Take other options for mysql driver
// See https://github.com/loopbackio/loopback-connector-mysql/issues/46 // See https://github.com/loopbackio/loopback-connector-mysql/issues/46
for (const p in s) { for (const p in s) {
if (p === 'database' && s.createDatabase) { if (
(p === 'database' && s.createDatabase) ||
generatorSpecificOptions.includes(p)
) {
continue; continue;
} }
if (options[p] === undefined) { if (options[p] === undefined) {