diff --git a/server/utils/database.ts b/server/utils/database.ts index d956d52..de9c79c 100644 --- a/server/utils/database.ts +++ b/server/utils/database.ts @@ -11,7 +11,9 @@ const connectionOptions: mysql.ConnectionOptions = { }; export const database = - await mysql.createConnection(connectionOptions) as Connection & { new: () => Promise }; -database.new = () => { return mysql.createConnection(connectionOptions); }; + await mysql.createConnection(connectionOptions) as Connection & { + new: (localConnectionOptions: mysql.ConnectionOptions | undefined) => Promise + }; +database.new = (localConnectionOptions: mysql.ConnectionOptions | undefined) => { return mysql.createConnection({ ...localConnectionOptions, ...connectionOptions }); }; export type data = [T[], mysql.FieldPacket[]];