dbgate-datalib 5.5.7-alpha.29 → 5.5.7-alpha.33
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.
|
@@ -12,6 +12,7 @@ export declare class ScriptDrivedDeployer {
|
|
|
12
12
|
dbhan: any;
|
|
13
13
|
driver: EngineDriver;
|
|
14
14
|
files: DatabaseModelFile[];
|
|
15
|
+
crypto: any;
|
|
15
16
|
predeploy: DatabaseModelFile[];
|
|
16
17
|
uninstall: DatabaseModelFile[];
|
|
17
18
|
install: DatabaseModelFile[];
|
|
@@ -19,7 +20,7 @@ export declare class ScriptDrivedDeployer {
|
|
|
19
20
|
postdeploy: DatabaseModelFile[];
|
|
20
21
|
isEmpty: boolean;
|
|
21
22
|
journalItems: DeployScriptJournalItem[];
|
|
22
|
-
constructor(dbhan: any, driver: EngineDriver, files: DatabaseModelFile[]);
|
|
23
|
+
constructor(dbhan: any, driver: EngineDriver, files: DatabaseModelFile[], crypto: any);
|
|
23
24
|
loadJournalItems(): Promise<void>;
|
|
24
25
|
runPre(): Promise<void>;
|
|
25
26
|
runPost(): Promise<void>;
|
|
@@ -14,14 +14,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ScriptDrivedDeployer = void 0;
|
|
16
16
|
const dbgate_tools_1 = require("dbgate-tools");
|
|
17
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
18
17
|
const sortBy_1 = __importDefault(require("lodash/sortBy"));
|
|
19
18
|
const logger = (0, dbgate_tools_1.getLogger)('ScriptDrivedDeployer');
|
|
20
19
|
class ScriptDrivedDeployer {
|
|
21
|
-
constructor(dbhan, driver, files) {
|
|
20
|
+
constructor(dbhan, driver, files, crypto) {
|
|
22
21
|
this.dbhan = dbhan;
|
|
23
22
|
this.driver = driver;
|
|
24
23
|
this.files = files;
|
|
24
|
+
this.crypto = crypto;
|
|
25
25
|
this.predeploy = [];
|
|
26
26
|
this.uninstall = [];
|
|
27
27
|
this.install = [];
|
|
@@ -141,7 +141,7 @@ class ScriptDrivedDeployer {
|
|
|
141
141
|
}
|
|
142
142
|
runFile(file, category) {
|
|
143
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
const hash =
|
|
144
|
+
const hash = this.crypto.createHash('md5').update(file.text.trim()).digest('hex');
|
|
145
145
|
const journalItem = this.journalItems.find(x => x.name == file.name);
|
|
146
146
|
const isEqual = journalItem && journalItem.script_hash == hash;
|
|
147
147
|
switch (category) {
|
|
@@ -160,7 +160,7 @@ class ScriptDrivedDeployer {
|
|
|
160
160
|
const uninstallFile = this.uninstall.find(x => x.name == file.name.replace('.install.sql', '.uninstall.sql'));
|
|
161
161
|
if (uninstallFile && journalItem) {
|
|
162
162
|
// file was previously installed, uninstall first
|
|
163
|
-
yield this.runFileCore(uninstallFile, 'uninstall',
|
|
163
|
+
yield this.runFileCore(uninstallFile, 'uninstall', this.crypto.createHash('md5').update(uninstallFile.text.trim()).digest('hex'));
|
|
164
164
|
}
|
|
165
165
|
yield this.runFileCore(file, category, hash);
|
|
166
166
|
break;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.5.7-alpha.
|
|
2
|
+
"version": "5.5.7-alpha.33",
|
|
3
3
|
"name": "dbgate-datalib",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"lib"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"dbgate-sqltree": "^5.5.7-alpha.
|
|
17
|
-
"dbgate-tools": "^5.5.7-alpha.
|
|
18
|
-
"dbgate-filterparser": "^5.5.7-alpha.
|
|
16
|
+
"dbgate-sqltree": "^5.5.7-alpha.33",
|
|
17
|
+
"dbgate-tools": "^5.5.7-alpha.33",
|
|
18
|
+
"dbgate-filterparser": "^5.5.7-alpha.33",
|
|
19
19
|
"uuid": "^3.4.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"dbgate-types": "^5.5.7-alpha.
|
|
22
|
+
"dbgate-types": "^5.5.7-alpha.33",
|
|
23
23
|
"@types/node": "^13.7.0",
|
|
24
24
|
"jest": "^28.1.3",
|
|
25
25
|
"ts-jest": "^28.0.7",
|