Merge pull request #311 from ekonetzni/mysql8-support

Mysql8 support
This commit is contained in:
kononnable 2020-12-29 17:48:11 +01:00 committed by GitHub
commit 7bbe9254eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1025 additions and 2533 deletions

3546
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
"handlebars": "^4.7.6",
"inquirer": "^7.3.3",
"mssql": "^6.3.0",
"mysql": "^2.18.1",
"mysql2": "^2.2.5",
"pg": "^8.5.1",
"pluralize": "^8.0.0",
"prettier": "^2.2.1",

View File

@ -1,4 +1,4 @@
import type * as MYSQL from "mysql";
import type * as MYSQL from "mysql2";
import { ConnectionOptions } from "typeorm";
import * as TypeormDriver from "typeorm/driver/mysql/MysqlDriver";
import { DataTypeDefaults } from "typeorm/driver/types/DataTypeDefaults";
@ -32,7 +32,7 @@ export default class MysqlDriver extends AbstractDriver {
super();
try {
// eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved
this.MYSQL = require("mysql");
this.MYSQL = require("mysql2");
} catch (error) {
TomgUtils.LogError("", false, error);
throw error;
@ -466,7 +466,7 @@ export default class MysqlDriver extends AbstractDriver {
public async ConnectToServer(connectionOptons: IConnectionOptions) {
const databaseName = connectionOptons.databaseNames[0];
let config: MYSQL.ConnectionConfig;
let config: MYSQL.ConnectionOptions;
if (connectionOptons.ssl) {
config = {
database: databaseName,
@ -476,7 +476,7 @@ export default class MysqlDriver extends AbstractDriver {
ssl: {
rejectUnauthorized: false,
},
timeout: 60 * 60 * 1000,
connectTimeout: 60 * 60 * 1000,
user: connectionOptons.user,
};
} else {
@ -485,7 +485,7 @@ export default class MysqlDriver extends AbstractDriver {
host: connectionOptons.host,
password: connectionOptons.password,
port: connectionOptons.port,
timeout: 60 * 60 * 1000,
connectTimeout: 60 * 60 * 1000,
user: connectionOptons.user,
};
}