@axiosleo/orm-mysql 0.8.4 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -1
- package/package.json +1 -1
- package/src/client.js +2 -1
package/index.js
CHANGED
|
@@ -15,7 +15,9 @@ const {
|
|
|
15
15
|
getClient,
|
|
16
16
|
createPool,
|
|
17
17
|
createClient,
|
|
18
|
-
createPromiseClient
|
|
18
|
+
createPromiseClient,
|
|
19
|
+
|
|
20
|
+
MySQLClient
|
|
19
21
|
} = require('./src/client');
|
|
20
22
|
|
|
21
23
|
const Hook = require('./src/hook');
|
|
@@ -32,6 +34,7 @@ module.exports = {
|
|
|
32
34
|
TransactionOperator,
|
|
33
35
|
TransactionHandler,
|
|
34
36
|
|
|
37
|
+
MySQLClient,
|
|
35
38
|
getClient,
|
|
36
39
|
createPool,
|
|
37
40
|
createClient,
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -100,6 +100,7 @@ class MySQLClient extends QueryHandler {
|
|
|
100
100
|
constructor(options, name = 'default') {
|
|
101
101
|
const conn = createClient(options, name);
|
|
102
102
|
super(conn);
|
|
103
|
+
this.database = options.database;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
async existTable(table, database = null) {
|
|
@@ -107,7 +108,7 @@ class MySQLClient extends QueryHandler {
|
|
|
107
108
|
throw new Error('table name is required');
|
|
108
109
|
}
|
|
109
110
|
const c = await this.table('information_schema.TABLES')
|
|
110
|
-
.where('TABLE_SCHEMA', database)
|
|
111
|
+
.where('TABLE_SCHEMA', database || this.database)
|
|
111
112
|
.where('TABLE_NAME', table)
|
|
112
113
|
.count();
|
|
113
114
|
return !!c;
|