dbgate-tools 6.1.2 → 6.1.4
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/lib/DatabaseAnalyser.js +12 -1
- package/lib/SqlDumper.d.ts +6 -2
- package/lib/SqlDumper.js +9 -0
- package/lib/SqlGenerator.d.ts +5 -1
- package/lib/SqlGenerator.js +9 -1
- package/lib/dbKeysLoader.d.ts +35 -0
- package/lib/dbKeysLoader.js +132 -0
- package/lib/diffTools.js +11 -3
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/structureTools.d.ts +1 -0
- package/package.json +4 -4
package/lib/DatabaseAnalyser.js
CHANGED
|
@@ -21,7 +21,16 @@ const getLogger_1 = require("./getLogger");
|
|
|
21
21
|
const schemaInfoTools_1 = require("./schemaInfoTools");
|
|
22
22
|
const stringTools_1 = require("./stringTools");
|
|
23
23
|
const logger = (0, getLogger_1.getLogger)('dbAnalyser');
|
|
24
|
-
const STRUCTURE_FIELDS = [
|
|
24
|
+
const STRUCTURE_FIELDS = [
|
|
25
|
+
'tables',
|
|
26
|
+
'collections',
|
|
27
|
+
'views',
|
|
28
|
+
'matviews',
|
|
29
|
+
'functions',
|
|
30
|
+
'procedures',
|
|
31
|
+
'triggers',
|
|
32
|
+
'schedulerEvents',
|
|
33
|
+
];
|
|
25
34
|
const fp_pick = arg => array => (0, pick_1.default)(array, arg);
|
|
26
35
|
function mergeTableRowCounts(info, rowCounts) {
|
|
27
36
|
return Object.assign(Object.assign({}, info), { tables: (info.tables || []).map(table => {
|
|
@@ -241,6 +250,7 @@ class DatabaseAnalyser {
|
|
|
241
250
|
...this.getDeletedObjectsForField(snapshot, 'procedures'),
|
|
242
251
|
...this.getDeletedObjectsForField(snapshot, 'functions'),
|
|
243
252
|
...this.getDeletedObjectsForField(snapshot, 'triggers'),
|
|
253
|
+
...this.getDeletedObjectsForField(snapshot, 'schedulerEvents'),
|
|
244
254
|
];
|
|
245
255
|
}
|
|
246
256
|
feedback(obj) {
|
|
@@ -336,6 +346,7 @@ class DatabaseAnalyser {
|
|
|
336
346
|
functions: [],
|
|
337
347
|
procedures: [],
|
|
338
348
|
triggers: [],
|
|
349
|
+
schedulerEvents: [],
|
|
339
350
|
};
|
|
340
351
|
}
|
|
341
352
|
static byTableFilter(table) {
|
package/lib/SqlDumper.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColumnInfo, ConstraintInfo, EngineDriver, ForeignKeyInfo, FunctionInfo, NamedObjectInfo, PrimaryKeyInfo, ProcedureInfo, SqlDialect, TableInfo, TransformType, TriggerInfo, ViewInfo, IndexInfo, UniqueInfo, CheckInfo, AlterProcessor, SqlObjectInfo, CallableObjectInfo } from 'dbgate-types';
|
|
1
|
+
import type { ColumnInfo, ConstraintInfo, EngineDriver, ForeignKeyInfo, FunctionInfo, NamedObjectInfo, PrimaryKeyInfo, ProcedureInfo, SqlDialect, TableInfo, TransformType, TriggerInfo, ViewInfo, IndexInfo, UniqueInfo, CheckInfo, AlterProcessor, SqlObjectInfo, CallableObjectInfo, SchedulerEventInfo } from 'dbgate-types';
|
|
2
2
|
export declare class SqlDumper implements AlterProcessor {
|
|
3
3
|
s: string;
|
|
4
4
|
driver: EngineDriver;
|
|
@@ -75,6 +75,10 @@ export declare class SqlDumper implements AlterProcessor {
|
|
|
75
75
|
alterTrigger(obj: TriggerInfo): void;
|
|
76
76
|
changeTriggerSchema(obj: TriggerInfo, newSchema: string): void;
|
|
77
77
|
renameTrigger(obj: TriggerInfo, newSchema: string): void;
|
|
78
|
+
createSchedulerEvent(obj: SchedulerEventInfo): void;
|
|
79
|
+
dropSchedulerEvent(obj: SchedulerEventInfo, { testIfExists }: {
|
|
80
|
+
testIfExists?: boolean;
|
|
81
|
+
}): void;
|
|
78
82
|
dropConstraintCore(cnt: ConstraintInfo): void;
|
|
79
83
|
dropConstraint(cnt: ConstraintInfo): void;
|
|
80
84
|
createConstraint(cnt: ConstraintInfo): void;
|
|
@@ -113,7 +117,7 @@ export declare class SqlDumper implements AlterProcessor {
|
|
|
113
117
|
dropConstraints(table: TableInfo, dropReferences?: boolean): void;
|
|
114
118
|
recreateTable(oldTable: TableInfo, newTable: TableInfo): void;
|
|
115
119
|
createSqlObject(obj: SqlObjectInfo): void;
|
|
116
|
-
getSqlObjectSqlName(ojectTypeField: string): "PROCEDURE" | "VIEW" | "FUNCTION" | "TRIGGER" | "MATERIALIZED VIEW";
|
|
120
|
+
getSqlObjectSqlName(ojectTypeField: string): "PROCEDURE" | "VIEW" | "FUNCTION" | "TRIGGER" | "MATERIALIZED VIEW" | "EVENT";
|
|
117
121
|
dropSqlObject(obj: SqlObjectInfo): void;
|
|
118
122
|
setTableOption(table: TableInfo, optionName: string, optionValue: string): void;
|
|
119
123
|
setTableOptionCore(table: TableInfo, optionName: string, optionValue: string, formatString: string): void;
|
package/lib/SqlDumper.js
CHANGED
|
@@ -392,6 +392,13 @@ class SqlDumper {
|
|
|
392
392
|
}
|
|
393
393
|
changeTriggerSchema(obj, newSchema) { }
|
|
394
394
|
renameTrigger(obj, newSchema) { }
|
|
395
|
+
createSchedulerEvent(obj) {
|
|
396
|
+
this.putRaw(obj.createSql);
|
|
397
|
+
this.endCommand();
|
|
398
|
+
}
|
|
399
|
+
dropSchedulerEvent(obj, { testIfExists = false }) {
|
|
400
|
+
this.putCmd('^drop ^event %f', obj);
|
|
401
|
+
}
|
|
395
402
|
dropConstraintCore(cnt) {
|
|
396
403
|
this.putCmd('^alter ^table %f ^drop ^constraint %i', cnt, cnt.constraintName);
|
|
397
404
|
}
|
|
@@ -617,6 +624,8 @@ class SqlDumper {
|
|
|
617
624
|
return 'TRIGGER';
|
|
618
625
|
case 'matviews':
|
|
619
626
|
return 'MATERIALIZED VIEW';
|
|
627
|
+
case 'schedulerEvents':
|
|
628
|
+
return 'EVENT';
|
|
620
629
|
}
|
|
621
630
|
}
|
|
622
631
|
dropSqlObject(obj) {
|
package/lib/SqlGenerator.d.ts
CHANGED
|
@@ -28,11 +28,14 @@ interface SqlGeneratorOptions {
|
|
|
28
28
|
dropTriggers: boolean;
|
|
29
29
|
checkIfTriggerExists: boolean;
|
|
30
30
|
createTriggers: boolean;
|
|
31
|
+
dropSchedulerEvents: boolean;
|
|
32
|
+
checkIfSchedulerEventExists: boolean;
|
|
33
|
+
createSchedulerEvents: boolean;
|
|
31
34
|
}
|
|
32
35
|
interface SqlGeneratorObject {
|
|
33
36
|
schemaName: string;
|
|
34
37
|
pureName: string;
|
|
35
|
-
objectTypeField: 'tables' | 'views' | 'procedures' | 'functions';
|
|
38
|
+
objectTypeField: 'tables' | 'views' | 'procedures' | 'functions' | 'triggers' | 'schedulerEvents';
|
|
36
39
|
}
|
|
37
40
|
export declare class SqlGenerator {
|
|
38
41
|
options: SqlGeneratorOptions;
|
|
@@ -46,6 +49,7 @@ export declare class SqlGenerator {
|
|
|
46
49
|
private procedures;
|
|
47
50
|
private functions;
|
|
48
51
|
private triggers;
|
|
52
|
+
private schedulerEvents;
|
|
49
53
|
dbinfo: DatabaseInfo;
|
|
50
54
|
isTruncated: boolean;
|
|
51
55
|
isUnhandledException: boolean;
|
package/lib/SqlGenerator.js
CHANGED
|
@@ -39,6 +39,7 @@ class SqlGenerator {
|
|
|
39
39
|
this.procedures = this.extract('procedures');
|
|
40
40
|
this.functions = this.extract('functions');
|
|
41
41
|
this.triggers = this.extract('triggers');
|
|
42
|
+
this.schedulerEvents = this.extract('schedulerEvents');
|
|
42
43
|
}
|
|
43
44
|
dump() {
|
|
44
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -57,6 +58,9 @@ class SqlGenerator {
|
|
|
57
58
|
if (this.checkDumper())
|
|
58
59
|
return;
|
|
59
60
|
this.dropObjects(this.triggers, 'Trigger');
|
|
61
|
+
if (this.checkDumper())
|
|
62
|
+
return;
|
|
63
|
+
this.dropObjects(this.schedulerEvents, 'SchedulerEvent');
|
|
60
64
|
if (this.checkDumper())
|
|
61
65
|
return;
|
|
62
66
|
this.dropTables();
|
|
@@ -89,6 +93,9 @@ class SqlGenerator {
|
|
|
89
93
|
this.createObjects(this.triggers, 'Trigger');
|
|
90
94
|
if (this.checkDumper())
|
|
91
95
|
return;
|
|
96
|
+
this.createObjects(this.schedulerEvents, 'SchedulerEvent');
|
|
97
|
+
if (this.checkDumper())
|
|
98
|
+
return;
|
|
92
99
|
}
|
|
93
100
|
finally {
|
|
94
101
|
process.off('uncaughtException', this.handleException);
|
|
@@ -230,7 +237,8 @@ class SqlGenerator {
|
|
|
230
237
|
});
|
|
231
238
|
}
|
|
232
239
|
extract(objectTypeField) {
|
|
233
|
-
|
|
240
|
+
var _a, _b;
|
|
241
|
+
return ((_b = (_a = this.dbinfo[objectTypeField]) === null || _a === void 0 ? void 0 : _a.filter(x => this.objects.find(y => x.pureName == y.pureName && x.schemaName == y.schemaName && y.objectTypeField == objectTypeField))) !== null && _b !== void 0 ? _b : []);
|
|
234
242
|
}
|
|
235
243
|
enableConstraints(enabled) {
|
|
236
244
|
if (this.options.disableConstraints) {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface DbKeysNodeModelBase {
|
|
2
|
+
text?: string;
|
|
3
|
+
count?: number;
|
|
4
|
+
level: number;
|
|
5
|
+
}
|
|
6
|
+
export interface DbKeysLeafNodeModel extends DbKeysNodeModelBase {
|
|
7
|
+
key: string;
|
|
8
|
+
type: 'string' | 'hash' | 'set' | 'list' | 'zset' | 'stream' | 'binary' | 'ReJSON-RL';
|
|
9
|
+
}
|
|
10
|
+
export interface DbKeysFolderNodeModel extends DbKeysNodeModelBase {
|
|
11
|
+
root: string;
|
|
12
|
+
type: 'dir';
|
|
13
|
+
maxShowCount?: number;
|
|
14
|
+
isExpanded?: boolean;
|
|
15
|
+
shouldLoadNext?: boolean;
|
|
16
|
+
hasNext?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface DbKeysTreeModel {
|
|
19
|
+
root: DbKeysFolderNodeModel;
|
|
20
|
+
dirsByKey: {
|
|
21
|
+
[key: string]: DbKeysFolderNodeModel;
|
|
22
|
+
};
|
|
23
|
+
childrenByKey: {
|
|
24
|
+
[key: string]: DbKeysNodeModel[];
|
|
25
|
+
};
|
|
26
|
+
refreshAll?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type DbKeysNodeModel = DbKeysLeafNodeModel | DbKeysFolderNodeModel;
|
|
29
|
+
export type DbKeysLoadFunction = (root: string, limit: number) => Promise<DbKeysNodeModel[]>;
|
|
30
|
+
export type DbKeysChangeModelFunction = (func: (model: DbKeysTreeModel) => DbKeysTreeModel) => void;
|
|
31
|
+
export declare function dbKeys_loadMissing(tree: DbKeysTreeModel, loader: DbKeysLoadFunction): Promise<DbKeysTreeModel>;
|
|
32
|
+
export declare function dbKeys_markNodeExpanded(tree: DbKeysTreeModel, root: string, isExpanded: boolean): DbKeysTreeModel;
|
|
33
|
+
export declare function dbKeys_refreshAll(tree?: DbKeysTreeModel): DbKeysTreeModel;
|
|
34
|
+
export declare function dbKeys_reloadFolder(tree: DbKeysTreeModel, root: string): DbKeysTreeModel;
|
|
35
|
+
export declare function dbKeys_getFlatList(tree: DbKeysTreeModel): DbKeysNodeModel[];
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.dbKeys_getFlatList = exports.dbKeys_reloadFolder = exports.dbKeys_refreshAll = exports.dbKeys_markNodeExpanded = exports.dbKeys_loadMissing = void 0;
|
|
16
|
+
const omit_1 = __importDefault(require("lodash/omit"));
|
|
17
|
+
const SHOW_INCREMENT = 100;
|
|
18
|
+
// function dbKeys_findFolderNode(node: DbKeysNodeModel, root: string) {
|
|
19
|
+
// if (node.type != 'dir') {
|
|
20
|
+
// return null;
|
|
21
|
+
// }
|
|
22
|
+
// if (node.root === root) {
|
|
23
|
+
// return node;
|
|
24
|
+
// }
|
|
25
|
+
// for (const child of node.children ?? []) {
|
|
26
|
+
// const res = dbKeys_findFolderNode(child, root);
|
|
27
|
+
// if (res) {
|
|
28
|
+
// return res;
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
// return null;
|
|
32
|
+
// }
|
|
33
|
+
// export async function dbKeys_loadKeysFromNode(
|
|
34
|
+
// tree: DbKeysTreeModel,
|
|
35
|
+
// callingRoot: string,
|
|
36
|
+
// separator: string,
|
|
37
|
+
// loader: DbKeysLoadFunction
|
|
38
|
+
// ): Promise<DbKeysTreeModel> {
|
|
39
|
+
// const callingRootNode = tree.dirsByKey[callingRoot];
|
|
40
|
+
// if (!callingRootNode) {
|
|
41
|
+
// return tree;
|
|
42
|
+
// }
|
|
43
|
+
// const newItems = await loader(callingRoot, callingRootNode.maxShowCount ?? SHOW_INCREMENT);
|
|
44
|
+
// return {
|
|
45
|
+
// ...tree,
|
|
46
|
+
// childrenByKey: {
|
|
47
|
+
// ...tree.childrenByKey,
|
|
48
|
+
// [callingRoot]: newItems,
|
|
49
|
+
// },
|
|
50
|
+
// };
|
|
51
|
+
// }
|
|
52
|
+
function dbKeys_loadMissing(tree, loader) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const childrenByKey = Object.assign({}, tree.childrenByKey);
|
|
55
|
+
const dirsByKey = Object.assign({}, tree.dirsByKey);
|
|
56
|
+
for (const root in tree.dirsByKey) {
|
|
57
|
+
const dir = tree.dirsByKey[root];
|
|
58
|
+
if (dir.isExpanded && dir.shouldLoadNext) {
|
|
59
|
+
if (!tree.childrenByKey[root] || dir.hasNext) {
|
|
60
|
+
const loadCount = dir.maxShowCount && dir.shouldLoadNext ? dir.maxShowCount + SHOW_INCREMENT : SHOW_INCREMENT;
|
|
61
|
+
const items = yield loader(root, loadCount + 1);
|
|
62
|
+
childrenByKey[root] = items.slice(0, loadCount);
|
|
63
|
+
dirsByKey[root] = Object.assign(Object.assign({}, dir), { shouldLoadNext: false, maxShowCount: loadCount, hasNext: items.length > loadCount });
|
|
64
|
+
for (const child of items.slice(0, loadCount)) {
|
|
65
|
+
if (child.type == 'dir' && !dirsByKey[child.root]) {
|
|
66
|
+
dirsByKey[child.root] = {
|
|
67
|
+
shouldLoadNext: false,
|
|
68
|
+
maxShowCount: null,
|
|
69
|
+
hasNext: false,
|
|
70
|
+
isExpanded: false,
|
|
71
|
+
type: 'dir',
|
|
72
|
+
level: dir.level + 1,
|
|
73
|
+
root: child.root,
|
|
74
|
+
text: child.text,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
dirsByKey[root] = Object.assign(Object.assign({}, dir), { shouldLoadNext: false });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return Object.assign(Object.assign({}, tree), { dirsByKey,
|
|
85
|
+
childrenByKey, refreshAll: false });
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
exports.dbKeys_loadMissing = dbKeys_loadMissing;
|
|
89
|
+
function dbKeys_markNodeExpanded(tree, root, isExpanded) {
|
|
90
|
+
const node = tree.dirsByKey[root];
|
|
91
|
+
if (!node) {
|
|
92
|
+
return tree;
|
|
93
|
+
}
|
|
94
|
+
return Object.assign(Object.assign({}, tree), { dirsByKey: Object.assign(Object.assign({}, tree.dirsByKey), { [root]: Object.assign(Object.assign({}, node), { isExpanded, shouldLoadNext: isExpanded }) }) });
|
|
95
|
+
}
|
|
96
|
+
exports.dbKeys_markNodeExpanded = dbKeys_markNodeExpanded;
|
|
97
|
+
function dbKeys_refreshAll(tree) {
|
|
98
|
+
const root = {
|
|
99
|
+
isExpanded: true,
|
|
100
|
+
level: 0,
|
|
101
|
+
root: '',
|
|
102
|
+
type: 'dir',
|
|
103
|
+
shouldLoadNext: true,
|
|
104
|
+
};
|
|
105
|
+
return Object.assign(Object.assign({}, tree), { childrenByKey: {}, dirsByKey: {
|
|
106
|
+
'': root,
|
|
107
|
+
}, refreshAll: true, root });
|
|
108
|
+
}
|
|
109
|
+
exports.dbKeys_refreshAll = dbKeys_refreshAll;
|
|
110
|
+
function dbKeys_reloadFolder(tree, root) {
|
|
111
|
+
return Object.assign(Object.assign({}, tree), { childrenByKey: (0, omit_1.default)(tree.childrenByKey, root), dirsByKey: Object.assign(Object.assign({}, tree.dirsByKey), { [root]: Object.assign(Object.assign({}, tree.dirsByKey[root]), { shouldLoadNext: true, hasNext: undefined }) }) });
|
|
112
|
+
}
|
|
113
|
+
exports.dbKeys_reloadFolder = dbKeys_reloadFolder;
|
|
114
|
+
function addFlatItems(tree, root, res) {
|
|
115
|
+
const item = tree.dirsByKey[root];
|
|
116
|
+
if (!item.isExpanded) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
const children = tree.childrenByKey[root] || [];
|
|
120
|
+
for (const child of children) {
|
|
121
|
+
res.push(child);
|
|
122
|
+
if (child.type == 'dir') {
|
|
123
|
+
addFlatItems(tree, child.root, res);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function dbKeys_getFlatList(tree) {
|
|
128
|
+
const res = [];
|
|
129
|
+
addFlatItems(tree, '', res);
|
|
130
|
+
return res;
|
|
131
|
+
}
|
|
132
|
+
exports.dbKeys_getFlatList = dbKeys_getFlatList;
|
package/lib/diffTools.js
CHANGED
|
@@ -42,12 +42,12 @@ function generateObjectPairingId(obj) {
|
|
|
42
42
|
return obj;
|
|
43
43
|
}
|
|
44
44
|
function generateDbPairingId(db) {
|
|
45
|
-
var _a, _b, _c, _d, _e, _f;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
46
46
|
if (!db)
|
|
47
47
|
return db;
|
|
48
48
|
return Object.assign(Object.assign({}, db), {
|
|
49
49
|
// ..._.mapValues(db, v => (_.isArray(v) ? v.map(generateObjectPairingId) : v)),
|
|
50
|
-
tables: (_a = db.tables) === null || _a === void 0 ? void 0 : _a.map(generateTablePairingId), views: (_b = db.views) === null || _b === void 0 ? void 0 : _b.map(generateObjectPairingId), procedures: (_c = db.procedures) === null || _c === void 0 ? void 0 : _c.map(generateObjectPairingId), functions: (_d = db.functions) === null || _d === void 0 ? void 0 : _d.map(generateObjectPairingId), triggers: (_e = db.triggers) === null || _e === void 0 ? void 0 : _e.map(generateObjectPairingId),
|
|
50
|
+
tables: (_a = db.tables) === null || _a === void 0 ? void 0 : _a.map(generateTablePairingId), views: (_b = db.views) === null || _b === void 0 ? void 0 : _b.map(generateObjectPairingId), procedures: (_c = db.procedures) === null || _c === void 0 ? void 0 : _c.map(generateObjectPairingId), functions: (_d = db.functions) === null || _d === void 0 ? void 0 : _d.map(generateObjectPairingId), triggers: (_e = db.triggers) === null || _e === void 0 ? void 0 : _e.map(generateObjectPairingId), schedulerEvents: (_f = db.schedulerEvents) === null || _f === void 0 ? void 0 : _f.map(generateObjectPairingId), matviews: (_g = db.matviews) === null || _g === void 0 ? void 0 : _g.map(generateObjectPairingId) });
|
|
51
51
|
}
|
|
52
52
|
exports.generateDbPairingId = generateDbPairingId;
|
|
53
53
|
function getNameWithoutDeletedPrefix(name, opts, deletedPrefix) {
|
|
@@ -519,7 +519,15 @@ function sortViewsByDependency(views) {
|
|
|
519
519
|
}
|
|
520
520
|
function createAlterDatabasePlan(oldDb, newDb, opts, wholeOldDb, wholeNewDb, driver) {
|
|
521
521
|
const plan = new alterPlan_1.AlterPlan(wholeOldDb, wholeNewDb, driver.dialect, opts);
|
|
522
|
-
for (const objectTypeField of [
|
|
522
|
+
for (const objectTypeField of [
|
|
523
|
+
'tables',
|
|
524
|
+
'views',
|
|
525
|
+
'procedures',
|
|
526
|
+
'matviews',
|
|
527
|
+
'functions',
|
|
528
|
+
'triggers',
|
|
529
|
+
'schedulerEvents',
|
|
530
|
+
]) {
|
|
523
531
|
for (const oldobj of oldDb[objectTypeField] || []) {
|
|
524
532
|
const newobj = (newDb[objectTypeField] || []).find(x => x.pairingId == oldobj.pairingId);
|
|
525
533
|
if (objectTypeField == 'tables') {
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -40,3 +40,4 @@ __exportStar(require("./getConnectionLabel"), exports);
|
|
|
40
40
|
__exportStar(require("./detectSqlFilterBehaviour"), exports);
|
|
41
41
|
__exportStar(require("./filterBehaviours"), exports);
|
|
42
42
|
__exportStar(require("./schemaInfoTools"), exports);
|
|
43
|
+
__exportStar(require("./dbKeysLoader"), exports);
|
package/lib/structureTools.d.ts
CHANGED
|
@@ -28,4 +28,5 @@ export declare function skipDbGateInternalObjects(db: DatabaseInfo): {
|
|
|
28
28
|
procedures: import("dbgate-types").ProcedureInfo[];
|
|
29
29
|
functions: import("dbgate-types").FunctionInfo[];
|
|
30
30
|
triggers: import("dbgate-types").TriggerInfo[];
|
|
31
|
+
schedulerEvents: import("dbgate-types").SchedulerEventInfo[];
|
|
31
32
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "6.1.
|
|
2
|
+
"version": "6.1.4",
|
|
3
3
|
"name": "dbgate-tools",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^13.7.0",
|
|
28
|
-
"dbgate-types": "^6.1.
|
|
28
|
+
"dbgate-types": "^6.1.4",
|
|
29
29
|
"jest": "^24.9.0",
|
|
30
30
|
"ts-jest": "^25.2.1",
|
|
31
31
|
"typescript": "^4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"dbgate-query-splitter": "^4.11.
|
|
35
|
-
"dbgate-sqltree": "^6.1.
|
|
34
|
+
"dbgate-query-splitter": "^4.11.3",
|
|
35
|
+
"dbgate-sqltree": "^6.1.4",
|
|
36
36
|
"debug": "^4.3.4",
|
|
37
37
|
"json-stable-stringify": "^1.0.1",
|
|
38
38
|
"lodash": "^4.17.21",
|