@midwayjs/typeorm 3.9.3 → 3.9.5
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/cli.js +10 -2
- package/dist/dataSourceManager.js +3 -0
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -9,6 +9,8 @@ const ImportUtils = require('typeorm/util/ImportUtils');
|
|
|
9
9
|
// eslint-disable-next-line node/no-unpublished-require
|
|
10
10
|
const { DataSource } = require('typeorm');
|
|
11
11
|
|
|
12
|
+
const originLoadDataSource = CommandUtils.loadDataSource;
|
|
13
|
+
|
|
12
14
|
CommandUtils.loadDataSource = async function (dataSourceFilePath) {
|
|
13
15
|
try {
|
|
14
16
|
let dataSourceFileExports = await ImportUtils.importOrRequireFile(
|
|
@@ -28,8 +30,14 @@ CommandUtils.loadDataSource = async function (dataSourceFilePath) {
|
|
|
28
30
|
dataSourceFileExports.dataSource[
|
|
29
31
|
dataSourceFileExports['defaultClientName'] || 'default'
|
|
30
32
|
];
|
|
33
|
+
|
|
34
|
+
return new DataSource(dataSourceFileExports);
|
|
35
|
+
} else {
|
|
36
|
+
console.log(
|
|
37
|
+
'[midway:typeorm] Not found dataSource options and run origin loadDataSource method'
|
|
38
|
+
);
|
|
39
|
+
return originLoadDataSource(dataSourceFilePath);
|
|
31
40
|
}
|
|
32
|
-
return new DataSource(dataSourceFileExports);
|
|
33
41
|
}
|
|
34
42
|
} catch (err) {
|
|
35
43
|
throw new Error(
|
|
@@ -39,4 +47,4 @@ CommandUtils.loadDataSource = async function (dataSourceFilePath) {
|
|
|
39
47
|
};
|
|
40
48
|
|
|
41
49
|
// eslint-disable-next-line node/no-unpublished-require
|
|
42
|
-
require('typeorm/cli');
|
|
50
|
+
require('typeorm/cli-ts-node-commonjs');
|
|
@@ -20,6 +20,9 @@ let TypeORMDataSourceManager = class TypeORMDataSourceManager extends core_1.Dat
|
|
|
20
20
|
return 'typeorm';
|
|
21
21
|
}
|
|
22
22
|
async createDataSource(config, dataSourceName) {
|
|
23
|
+
if (config['migrations']) {
|
|
24
|
+
delete config['migrations'];
|
|
25
|
+
}
|
|
23
26
|
const dataSource = new typeorm_1.DataSource(config);
|
|
24
27
|
await dataSource.initialize();
|
|
25
28
|
return dataSource;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/typeorm",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.5",
|
|
4
4
|
"main": "dist/index",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"type": "git",
|
|
36
36
|
"url": "https://github.com/midwayjs/midway.git"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "753614cd3ff5491224d0a78afd31821ab8d60837"
|
|
39
39
|
}
|