mysqlsyncr 1.0.62 → 1.0.66
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/__tests__/import.cjs +1 -1
- package/dist/index.cjs +30 -26
- package/dist/index.js +30 -26
- package/package.json +1 -1
- package/src/differences.js +25 -24
- package/src/index.js +3 -2
- package/src/socketServer.js +1 -2
package/__tests__/import.cjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3456,36 +3456,39 @@ var findDifferences = function findDifferences(expected, current) {
|
|
|
3456
3456
|
}
|
|
3457
3457
|
|
|
3458
3458
|
// Compare stored procedures
|
|
3459
|
-
if (!expected.procedures)
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
var
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
}, contents));
|
|
3473
|
-
return 1; // continue
|
|
3474
|
-
}
|
|
3475
|
-
|
|
3476
|
-
// Check if the procedure definition matches
|
|
3477
|
-
if (currentProc.Definition !== contents.Definition) {
|
|
3478
|
-
var normalizedCurrentDef = normalizeSQLDefinition(currentProc.Definition);
|
|
3479
|
-
var normalizedNewDef = normalizeSQLDefinition(contents.Definition);
|
|
3480
|
-
if (normalizedCurrentDef !== normalizedNewDef) {
|
|
3459
|
+
if (!expected.procedures) {
|
|
3460
|
+
console.log('No procedures found in expected for database', current.database);
|
|
3461
|
+
} else {
|
|
3462
|
+
var _loop6 = function _loop6() {
|
|
3463
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2);
|
|
3464
|
+
_Object$entries2$_i[0];
|
|
3465
|
+
var contents = _Object$entries2$_i[1];
|
|
3466
|
+
var procName = contents.Name;
|
|
3467
|
+
var currentProc = current.procedures.find(function (p) {
|
|
3468
|
+
return p.Name === procName;
|
|
3469
|
+
});
|
|
3470
|
+
if (!currentProc) {
|
|
3471
|
+
console.log('missing_procedure', contents);
|
|
3481
3472
|
differences.push(_objectSpread2({
|
|
3482
|
-
type: '
|
|
3473
|
+
type: 'missing_procedure'
|
|
3483
3474
|
}, contents));
|
|
3475
|
+
return 1; // continue
|
|
3484
3476
|
}
|
|
3477
|
+
|
|
3478
|
+
// Check if the procedure definition matches
|
|
3479
|
+
if (currentProc.Definition !== contents.Definition) {
|
|
3480
|
+
var normalizedCurrentDef = normalizeSQLDefinition(currentProc.Definition);
|
|
3481
|
+
var normalizedNewDef = normalizeSQLDefinition(contents.Definition);
|
|
3482
|
+
if (normalizedCurrentDef !== normalizedNewDef) {
|
|
3483
|
+
differences.push(_objectSpread2({
|
|
3484
|
+
type: 'mismatched_procedure'
|
|
3485
|
+
}, contents));
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
};
|
|
3489
|
+
for (var _i3 = 0, _Object$entries2 = Object.entries(expected.procedures); _i3 < _Object$entries2.length; _i3++) {
|
|
3490
|
+
if (_loop6()) continue;
|
|
3485
3491
|
}
|
|
3486
|
-
};
|
|
3487
|
-
for (var _i3 = 0, _Object$entries2 = Object.entries(expected.procedures); _i3 < _Object$entries2.length; _i3++) {
|
|
3488
|
-
if (_loop6()) continue;
|
|
3489
3492
|
}
|
|
3490
3493
|
|
|
3491
3494
|
// Compare views
|
|
@@ -5218,6 +5221,7 @@ var compare = /*#__PURE__*/function () {
|
|
|
5218
5221
|
var isMain = function () {
|
|
5219
5222
|
try {
|
|
5220
5223
|
console.log('Checking if this is the main module');
|
|
5224
|
+
console.log(require.main === module);
|
|
5221
5225
|
console.log(require.main);
|
|
5222
5226
|
return require.main === module;
|
|
5223
5227
|
} catch (e) {
|
package/dist/index.js
CHANGED
|
@@ -3453,36 +3453,39 @@ var findDifferences = function findDifferences(expected, current) {
|
|
|
3453
3453
|
}
|
|
3454
3454
|
|
|
3455
3455
|
// Compare stored procedures
|
|
3456
|
-
if (!expected.procedures)
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
var
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
}, contents));
|
|
3470
|
-
return 1; // continue
|
|
3471
|
-
}
|
|
3472
|
-
|
|
3473
|
-
// Check if the procedure definition matches
|
|
3474
|
-
if (currentProc.Definition !== contents.Definition) {
|
|
3475
|
-
var normalizedCurrentDef = normalizeSQLDefinition(currentProc.Definition);
|
|
3476
|
-
var normalizedNewDef = normalizeSQLDefinition(contents.Definition);
|
|
3477
|
-
if (normalizedCurrentDef !== normalizedNewDef) {
|
|
3456
|
+
if (!expected.procedures) {
|
|
3457
|
+
console.log('No procedures found in expected for database', current.database);
|
|
3458
|
+
} else {
|
|
3459
|
+
var _loop6 = function _loop6() {
|
|
3460
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2);
|
|
3461
|
+
_Object$entries2$_i[0];
|
|
3462
|
+
var contents = _Object$entries2$_i[1];
|
|
3463
|
+
var procName = contents.Name;
|
|
3464
|
+
var currentProc = current.procedures.find(function (p) {
|
|
3465
|
+
return p.Name === procName;
|
|
3466
|
+
});
|
|
3467
|
+
if (!currentProc) {
|
|
3468
|
+
console.log('missing_procedure', contents);
|
|
3478
3469
|
differences.push(_objectSpread2({
|
|
3479
|
-
type: '
|
|
3470
|
+
type: 'missing_procedure'
|
|
3480
3471
|
}, contents));
|
|
3472
|
+
return 1; // continue
|
|
3481
3473
|
}
|
|
3474
|
+
|
|
3475
|
+
// Check if the procedure definition matches
|
|
3476
|
+
if (currentProc.Definition !== contents.Definition) {
|
|
3477
|
+
var normalizedCurrentDef = normalizeSQLDefinition(currentProc.Definition);
|
|
3478
|
+
var normalizedNewDef = normalizeSQLDefinition(contents.Definition);
|
|
3479
|
+
if (normalizedCurrentDef !== normalizedNewDef) {
|
|
3480
|
+
differences.push(_objectSpread2({
|
|
3481
|
+
type: 'mismatched_procedure'
|
|
3482
|
+
}, contents));
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
};
|
|
3486
|
+
for (var _i3 = 0, _Object$entries2 = Object.entries(expected.procedures); _i3 < _Object$entries2.length; _i3++) {
|
|
3487
|
+
if (_loop6()) continue;
|
|
3482
3488
|
}
|
|
3483
|
-
};
|
|
3484
|
-
for (var _i3 = 0, _Object$entries2 = Object.entries(expected.procedures); _i3 < _Object$entries2.length; _i3++) {
|
|
3485
|
-
if (_loop6()) continue;
|
|
3486
3489
|
}
|
|
3487
3490
|
|
|
3488
3491
|
// Compare views
|
|
@@ -5215,6 +5218,7 @@ var compare = /*#__PURE__*/function () {
|
|
|
5215
5218
|
var isMain = function () {
|
|
5216
5219
|
try {
|
|
5217
5220
|
console.log('Checking if this is the main module');
|
|
5221
|
+
console.log(require.main === module);
|
|
5218
5222
|
console.log(require.main);
|
|
5219
5223
|
return require.main === module;
|
|
5220
5224
|
} catch (e) {
|
package/package.json
CHANGED
package/src/differences.js
CHANGED
|
@@ -15,7 +15,7 @@ export const findDifferences = (expected, current) => {
|
|
|
15
15
|
if (!expected.tables) throw new Error('No tables found in expected');
|
|
16
16
|
for (const [tableName, contents] of Object.entries(expected.tables)) {
|
|
17
17
|
//check if craete table matches from json, if so, we dont need to compare indexes, triggers, or fields
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
if (!current.tables[tableName]) {
|
|
20
20
|
console.log('missing_table', contents);
|
|
21
21
|
differences.push({ type: 'missing_table', tableName, createSQL: contents.createSQL });
|
|
@@ -134,28 +134,29 @@ export const findDifferences = (expected, current) => {
|
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
// Compare stored procedures
|
|
137
|
-
if (!expected.procedures)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
if (!expected.procedures) {
|
|
138
|
+
console.log('No procedures found in expected for database', current.database);
|
|
139
|
+
} else {
|
|
140
|
+
for (const [position, contents] of Object.entries(expected.procedures)) {
|
|
141
|
+
let procName = contents.Name;
|
|
142
|
+
let currentProc = current.procedures.find(p => p.Name === procName);
|
|
143
|
+
if (!currentProc) {
|
|
144
|
+
console.log('missing_procedure', contents);
|
|
145
|
+
differences.push({ type: 'missing_procedure', ...contents });
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
146
148
|
|
|
147
149
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
// Check if the procedure definition matches
|
|
151
|
+
if (currentProc.Definition !== contents.Definition) {
|
|
152
|
+
const normalizedCurrentDef = normalizeSQLDefinition(currentProc.Definition);
|
|
153
|
+
const normalizedNewDef = normalizeSQLDefinition(contents.Definition);
|
|
152
154
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
if (normalizedCurrentDef !== normalizedNewDef) {
|
|
156
|
+
differences.push({ type: 'mismatched_procedure', ...contents });
|
|
157
|
+
}
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
// Compare views
|
|
@@ -179,15 +180,15 @@ export const findDifferences = (expected, current) => {
|
|
|
179
180
|
if (!current.views[viewName]) {
|
|
180
181
|
differences.push({ type: 'missing_view', viewName, definition: expectedDefinition });
|
|
181
182
|
} else if (current.views[viewName] !== expectedDefinition) {
|
|
182
|
-
differences.push({
|
|
183
|
-
type: 'mismatched_view',
|
|
184
|
-
viewName,
|
|
185
|
-
definition: expectedDefinition,
|
|
186
|
-
current: current.views[viewName]
|
|
183
|
+
differences.push({
|
|
184
|
+
type: 'mismatched_view',
|
|
185
|
+
viewName,
|
|
186
|
+
definition: expectedDefinition,
|
|
187
|
+
current: current.views[viewName]
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
|
-
|
|
191
|
+
|
|
191
192
|
// Check for extra views
|
|
192
193
|
for (const viewName of Object.keys(current.views)) {
|
|
193
194
|
if (!expected.views[viewName]) {
|
package/src/index.js
CHANGED
|
@@ -64,8 +64,9 @@ export { DBStructureChecker, dumpAllDatabases, compare, startApiServer };
|
|
|
64
64
|
// Only run this if this is the main module
|
|
65
65
|
const isMain = (() => {
|
|
66
66
|
try {
|
|
67
|
-
console.log('Checking if this is the main module');
|
|
68
|
-
console.log(require.main)
|
|
67
|
+
// console.log('Checking if this is the main module');
|
|
68
|
+
// console.log(require.main === module)
|
|
69
|
+
// console.log(require.main);
|
|
69
70
|
return require.main === module;
|
|
70
71
|
} catch (e) {
|
|
71
72
|
return false;
|
package/src/socketServer.js
CHANGED
|
@@ -5,8 +5,7 @@ import { compareAllDatabases } from './compare.js';
|
|
|
5
5
|
import { DBStructureChecker } from './index.js'; // Import your DBStructureChecker class
|
|
6
6
|
import { applyDifferences } from './apply.js';
|
|
7
7
|
import cors from 'cors';
|
|
8
|
-
import {
|
|
9
|
-
import { dirname, join } from 'path';
|
|
8
|
+
import { join } from 'path';
|
|
10
9
|
import { readdir, mkdir } from 'fs/promises';
|
|
11
10
|
import { resolve } from 'path';
|
|
12
11
|
|