@berthojoris/mcp-mysql-server 1.10.3 → 1.10.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +18 -7
  2. package/DOCUMENTATIONS.md +2 -2
  3. package/dist/index.d.ts +0 -99
  4. package/dist/mcp-server.js +0 -21
  5. package/dist/tools/backupRestoreTools.d.ts +1 -6
  6. package/dist/tools/backupRestoreTools.js +99 -97
  7. package/dist/tools/constraintTools.d.ts +4 -11
  8. package/dist/tools/constraintTools.js +114 -115
  9. package/dist/tools/crudTools.d.ts +2 -6
  10. package/dist/tools/crudTools.js +186 -189
  11. package/dist/tools/dataExportTools.d.ts +0 -7
  12. package/dist/tools/dataExportTools.js +0 -15
  13. package/dist/tools/databaseTools.d.ts +1 -4
  14. package/dist/tools/databaseTools.js +29 -33
  15. package/dist/tools/ddlTools.d.ts +1 -5
  16. package/dist/tools/ddlTools.js +68 -53
  17. package/dist/tools/functionTools.d.ts +3 -9
  18. package/dist/tools/functionTools.js +111 -104
  19. package/dist/tools/indexTools.d.ts +3 -8
  20. package/dist/tools/indexTools.js +99 -95
  21. package/dist/tools/maintenanceTools.d.ts +2 -10
  22. package/dist/tools/maintenanceTools.js +66 -80
  23. package/dist/tools/migrationTools.d.ts +0 -5
  24. package/dist/tools/migrationTools.js +56 -24
  25. package/dist/tools/performanceTools.d.ts +1 -11
  26. package/dist/tools/performanceTools.js +278 -267
  27. package/dist/tools/processTools.d.ts +4 -13
  28. package/dist/tools/processTools.js +78 -80
  29. package/dist/tools/queryTools.d.ts +0 -2
  30. package/dist/tools/queryTools.js +0 -4
  31. package/dist/tools/schemaVersioningTools.d.ts +0 -9
  32. package/dist/tools/schemaVersioningTools.js +167 -166
  33. package/dist/tools/storedProcedureTools.d.ts +2 -4
  34. package/dist/tools/storedProcedureTools.js +143 -134
  35. package/dist/tools/transactionTools.d.ts +2 -3
  36. package/dist/tools/transactionTools.js +28 -29
  37. package/dist/tools/triggerTools.d.ts +3 -8
  38. package/dist/tools/triggerTools.js +98 -85
  39. package/dist/tools/utilityTools.d.ts +0 -1
  40. package/dist/tools/utilityTools.js +0 -2
  41. package/dist/tools/viewTools.d.ts +7 -13
  42. package/dist/tools/viewTools.js +100 -93
  43. package/package.json +1 -1
@@ -19,26 +19,26 @@ class MaintenanceTools {
19
19
  if (!connectedDatabase) {
20
20
  return {
21
21
  valid: false,
22
- database: '',
23
- error: 'No database specified in connection string. Cannot access any database.'
22
+ database: "",
23
+ error: "No database specified in connection string. Cannot access any database.",
24
24
  };
25
25
  }
26
26
  if (!requestedDatabase) {
27
27
  return {
28
28
  valid: true,
29
- database: connectedDatabase
29
+ database: connectedDatabase,
30
30
  };
31
31
  }
32
32
  if (requestedDatabase !== connectedDatabase) {
33
33
  return {
34
34
  valid: false,
35
- database: '',
36
- error: `Access denied. You can only access the connected database '${connectedDatabase}'. Requested database '${requestedDatabase}' is not allowed.`
35
+ database: "",
36
+ error: `Access denied. You can only access the connected database '${connectedDatabase}'. Requested database '${requestedDatabase}' is not allowed.`,
37
37
  };
38
38
  }
39
39
  return {
40
40
  valid: true,
41
- database: connectedDatabase
41
+ database: connectedDatabase,
42
42
  };
43
43
  }
44
44
  /**
@@ -48,27 +48,25 @@ class MaintenanceTools {
48
48
  try {
49
49
  const dbValidation = this.validateDatabaseAccess(params?.database);
50
50
  if (!dbValidation.valid) {
51
- return { status: 'error', error: dbValidation.error };
51
+ return { status: "error", error: dbValidation.error };
52
52
  }
53
53
  const { table_name } = params;
54
54
  const database = dbValidation.database;
55
55
  // Validate table name
56
56
  if (!this.security.validateIdentifier(table_name).valid) {
57
- return { status: 'error', error: 'Invalid table name' };
57
+ return { status: "error", error: "Invalid table name" };
58
58
  }
59
59
  const query = `ANALYZE TABLE \`${database}\`.\`${table_name}\``;
60
60
  const results = await this.db.query(query);
61
61
  return {
62
- status: 'success',
62
+ status: "success",
63
63
  data: results[0],
64
- queryLog: this.db.getFormattedQueryLogs(1)
65
64
  };
66
65
  }
67
66
  catch (error) {
68
67
  return {
69
- status: 'error',
68
+ status: "error",
70
69
  error: error.message,
71
- queryLog: this.db.getFormattedQueryLogs(1)
72
70
  };
73
71
  }
74
72
  }
@@ -79,27 +77,25 @@ class MaintenanceTools {
79
77
  try {
80
78
  const dbValidation = this.validateDatabaseAccess(params?.database);
81
79
  if (!dbValidation.valid) {
82
- return { status: 'error', error: dbValidation.error };
80
+ return { status: "error", error: dbValidation.error };
83
81
  }
84
82
  const { table_name } = params;
85
83
  const database = dbValidation.database;
86
84
  // Validate table name
87
85
  if (!this.security.validateIdentifier(table_name).valid) {
88
- return { status: 'error', error: 'Invalid table name' };
86
+ return { status: "error", error: "Invalid table name" };
89
87
  }
90
88
  const query = `OPTIMIZE TABLE \`${database}\`.\`${table_name}\``;
91
89
  const results = await this.db.query(query);
92
90
  return {
93
- status: 'success',
91
+ status: "success",
94
92
  data: results[0],
95
- queryLog: this.db.getFormattedQueryLogs(1)
96
93
  };
97
94
  }
98
95
  catch (error) {
99
96
  return {
100
- status: 'error',
97
+ status: "error",
101
98
  error: error.message,
102
- queryLog: this.db.getFormattedQueryLogs(1)
103
99
  };
104
100
  }
105
101
  }
@@ -110,13 +106,13 @@ class MaintenanceTools {
110
106
  try {
111
107
  const dbValidation = this.validateDatabaseAccess(params?.database);
112
108
  if (!dbValidation.valid) {
113
- return { status: 'error', error: dbValidation.error };
109
+ return { status: "error", error: dbValidation.error };
114
110
  }
115
111
  const { table_name, check_type } = params;
116
112
  const database = dbValidation.database;
117
113
  // Validate table name
118
114
  if (!this.security.validateIdentifier(table_name).valid) {
119
- return { status: 'error', error: 'Invalid table name' };
115
+ return { status: "error", error: "Invalid table name" };
120
116
  }
121
117
  let query = `CHECK TABLE \`${database}\`.\`${table_name}\``;
122
118
  if (check_type) {
@@ -124,16 +120,14 @@ class MaintenanceTools {
124
120
  }
125
121
  const results = await this.db.query(query);
126
122
  return {
127
- status: 'success',
123
+ status: "success",
128
124
  data: results[0],
129
- queryLog: this.db.getFormattedQueryLogs(1)
130
125
  };
131
126
  }
132
127
  catch (error) {
133
128
  return {
134
- status: 'error',
129
+ status: "error",
135
130
  error: error.message,
136
- queryLog: this.db.getFormattedQueryLogs(1)
137
131
  };
138
132
  }
139
133
  }
@@ -144,37 +138,35 @@ class MaintenanceTools {
144
138
  try {
145
139
  const dbValidation = this.validateDatabaseAccess(params?.database);
146
140
  if (!dbValidation.valid) {
147
- return { status: 'error', error: dbValidation.error };
141
+ return { status: "error", error: dbValidation.error };
148
142
  }
149
- const { table_name, quick = false, extended = false, use_frm = false } = params;
143
+ const { table_name, quick = false, extended = false, use_frm = false, } = params;
150
144
  const database = dbValidation.database;
151
145
  // Validate table name
152
146
  if (!this.security.validateIdentifier(table_name).valid) {
153
- return { status: 'error', error: 'Invalid table name' };
147
+ return { status: "error", error: "Invalid table name" };
154
148
  }
155
149
  let query = `REPAIR TABLE \`${database}\`.\`${table_name}\``;
156
150
  const options = [];
157
151
  if (quick)
158
- options.push('QUICK');
152
+ options.push("QUICK");
159
153
  if (extended)
160
- options.push('EXTENDED');
154
+ options.push("EXTENDED");
161
155
  if (use_frm)
162
- options.push('USE_FRM');
156
+ options.push("USE_FRM");
163
157
  if (options.length > 0) {
164
- query += ` ${options.join(' ')}`;
158
+ query += ` ${options.join(" ")}`;
165
159
  }
166
160
  const results = await this.db.query(query);
167
161
  return {
168
- status: 'success',
162
+ status: "success",
169
163
  data: results[0],
170
- queryLog: this.db.getFormattedQueryLogs(1)
171
164
  };
172
165
  }
173
166
  catch (error) {
174
167
  return {
175
- status: 'error',
168
+ status: "error",
176
169
  error: error.message,
177
- queryLog: this.db.getFormattedQueryLogs(1)
178
170
  };
179
171
  }
180
172
  }
@@ -185,27 +177,25 @@ class MaintenanceTools {
185
177
  try {
186
178
  const dbValidation = this.validateDatabaseAccess(params?.database);
187
179
  if (!dbValidation.valid) {
188
- return { status: 'error', error: dbValidation.error };
180
+ return { status: "error", error: dbValidation.error };
189
181
  }
190
182
  const { table_name } = params;
191
183
  const database = dbValidation.database;
192
184
  // Validate table name
193
185
  if (!this.security.validateIdentifier(table_name).valid) {
194
- return { status: 'error', error: 'Invalid table name' };
186
+ return { status: "error", error: "Invalid table name" };
195
187
  }
196
188
  const query = `TRUNCATE TABLE \`${database}\`.\`${table_name}\``;
197
189
  await this.db.query(query);
198
190
  return {
199
- status: 'success',
191
+ status: "success",
200
192
  message: `Table '${table_name}' truncated successfully`,
201
- queryLog: this.db.getFormattedQueryLogs(1)
202
193
  };
203
194
  }
204
195
  catch (error) {
205
196
  return {
206
- status: 'error',
197
+ status: "error",
207
198
  error: error.message,
208
- queryLog: this.db.getFormattedQueryLogs(1)
209
199
  };
210
200
  }
211
201
  }
@@ -216,20 +206,20 @@ class MaintenanceTools {
216
206
  try {
217
207
  const dbValidation = this.validateDatabaseAccess(params?.database);
218
208
  if (!dbValidation.valid) {
219
- return { status: 'error', error: dbValidation.error };
209
+ return { status: "error", error: dbValidation.error };
220
210
  }
221
211
  const { table_name } = params;
222
212
  const database = dbValidation.database;
223
213
  let query = `SHOW TABLE STATUS FROM \`${database}\``;
224
214
  if (table_name) {
225
215
  if (!this.security.validateIdentifier(table_name).valid) {
226
- return { status: 'error', error: 'Invalid table name' };
216
+ return { status: "error", error: "Invalid table name" };
227
217
  }
228
218
  query += ` LIKE '${table_name}'`;
229
219
  }
230
220
  const results = await this.db.query(query);
231
221
  // Format results for better readability
232
- const formattedResults = results.map(row => ({
222
+ const formattedResults = results.map((row) => ({
233
223
  table_name: row.Name,
234
224
  engine: row.Engine,
235
225
  version: row.Version,
@@ -247,19 +237,17 @@ class MaintenanceTools {
247
237
  collation: row.Collation,
248
238
  checksum: row.Checksum,
249
239
  create_options: row.Create_options,
250
- comment: row.Comment
240
+ comment: row.Comment,
251
241
  }));
252
242
  return {
253
- status: 'success',
243
+ status: "success",
254
244
  data: table_name ? formattedResults[0] : formattedResults,
255
- queryLog: this.db.getFormattedQueryLogs(1)
256
245
  };
257
246
  }
258
247
  catch (error) {
259
248
  return {
260
- status: 'error',
249
+ status: "error",
261
250
  error: error.message,
262
- queryLog: this.db.getFormattedQueryLogs(1)
263
251
  };
264
252
  }
265
253
  }
@@ -270,37 +258,35 @@ class MaintenanceTools {
270
258
  try {
271
259
  const dbValidation = this.validateDatabaseAccess(params?.database);
272
260
  if (!dbValidation.valid) {
273
- return { status: 'error', error: dbValidation.error };
261
+ return { status: "error", error: dbValidation.error };
274
262
  }
275
263
  const { table_name, with_read_lock = false } = params;
276
264
  const database = dbValidation.database;
277
265
  let query;
278
266
  if (table_name) {
279
267
  if (!this.security.validateIdentifier(table_name).valid) {
280
- return { status: 'error', error: 'Invalid table name' };
268
+ return { status: "error", error: "Invalid table name" };
281
269
  }
282
270
  query = `FLUSH TABLES \`${database}\`.\`${table_name}\``;
283
271
  if (with_read_lock) {
284
- query += ' WITH READ LOCK';
272
+ query += " WITH READ LOCK";
285
273
  }
286
274
  }
287
275
  else {
288
- query = with_read_lock ? 'FLUSH TABLES WITH READ LOCK' : 'FLUSH TABLES';
276
+ query = with_read_lock ? "FLUSH TABLES WITH READ LOCK" : "FLUSH TABLES";
289
277
  }
290
278
  await this.db.query(query);
291
279
  return {
292
- status: 'success',
280
+ status: "success",
293
281
  message: table_name
294
- ? `Table '${table_name}' flushed successfully${with_read_lock ? ' with read lock' : ''}`
295
- : `All tables flushed successfully${with_read_lock ? ' with read lock' : ''}`,
296
- queryLog: this.db.getFormattedQueryLogs(1)
282
+ ? `Table '${table_name}' flushed successfully${with_read_lock ? " with read lock" : ""}`
283
+ : `All tables flushed successfully${with_read_lock ? " with read lock" : ""}`,
297
284
  };
298
285
  }
299
286
  catch (error) {
300
287
  return {
301
- status: 'error',
288
+ status: "error",
302
289
  error: error.message,
303
- queryLog: this.db.getFormattedQueryLogs(1)
304
290
  };
305
291
  }
306
292
  }
@@ -311,28 +297,28 @@ class MaintenanceTools {
311
297
  try {
312
298
  const dbValidation = this.validateDatabaseAccess(params?.database);
313
299
  if (!dbValidation.valid) {
314
- return { status: 'error', error: dbValidation.error };
300
+ return { status: "error", error: dbValidation.error };
315
301
  }
316
302
  const { table_name } = params;
317
303
  const database = dbValidation.database;
318
- let query = `
319
- SELECT
320
- TABLE_NAME as table_name,
321
- TABLE_ROWS as row_count,
322
- DATA_LENGTH as data_size_bytes,
323
- INDEX_LENGTH as index_size_bytes,
324
- (DATA_LENGTH + INDEX_LENGTH) as total_size_bytes,
325
- ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024, 2) as total_size_mb,
326
- DATA_FREE as free_space_bytes,
327
- ENGINE as engine,
328
- TABLE_COLLATION as collation
329
- FROM INFORMATION_SCHEMA.TABLES
330
- WHERE TABLE_SCHEMA = ?
304
+ let query = `
305
+ SELECT
306
+ TABLE_NAME as table_name,
307
+ TABLE_ROWS as row_count,
308
+ DATA_LENGTH as data_size_bytes,
309
+ INDEX_LENGTH as index_size_bytes,
310
+ (DATA_LENGTH + INDEX_LENGTH) as total_size_bytes,
311
+ ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024, 2) as total_size_mb,
312
+ DATA_FREE as free_space_bytes,
313
+ ENGINE as engine,
314
+ TABLE_COLLATION as collation
315
+ FROM INFORMATION_SCHEMA.TABLES
316
+ WHERE TABLE_SCHEMA = ?
331
317
  `;
332
318
  const queryParams = [database];
333
319
  if (table_name) {
334
320
  if (!this.security.validateIdentifier(table_name).valid) {
335
- return { status: 'error', error: 'Invalid table name' };
321
+ return { status: "error", error: "Invalid table name" };
336
322
  }
337
323
  query += ` AND TABLE_NAME = ?`;
338
324
  queryParams.push(table_name);
@@ -347,23 +333,23 @@ class MaintenanceTools {
347
333
  total_rows: results.reduce((sum, r) => sum + (r.row_count || 0), 0),
348
334
  total_data_size_bytes: results.reduce((sum, r) => sum + (r.data_size_bytes || 0), 0),
349
335
  total_index_size_bytes: results.reduce((sum, r) => sum + (r.index_size_bytes || 0), 0),
350
- total_size_mb: results.reduce((sum, r) => sum + (parseFloat(r.total_size_mb) || 0), 0).toFixed(2)
336
+ total_size_mb: results
337
+ .reduce((sum, r) => sum + (parseFloat(r.total_size_mb) || 0), 0)
338
+ .toFixed(2),
351
339
  };
352
340
  }
353
341
  return {
354
- status: 'success',
342
+ status: "success",
355
343
  data: {
356
344
  tables: table_name ? results[0] : results,
357
- ...(totalStats && { summary: totalStats })
345
+ ...(totalStats && { summary: totalStats }),
358
346
  },
359
- queryLog: this.db.getFormattedQueryLogs(1)
360
347
  };
361
348
  }
362
349
  catch (error) {
363
350
  return {
364
- status: 'error',
351
+ status: "error",
365
352
  error: error.message,
366
- queryLog: this.db.getFormattedQueryLogs(1)
367
353
  };
368
354
  }
369
355
  }
@@ -30,7 +30,6 @@ export declare class MigrationTools {
30
30
  status: string;
31
31
  data?: any;
32
32
  error?: string;
33
- queryLog?: string;
34
33
  }>;
35
34
  /**
36
35
  * Move data from one table to another (copy + delete from source)
@@ -46,7 +45,6 @@ export declare class MigrationTools {
46
45
  status: string;
47
46
  data?: any;
48
47
  error?: string;
49
- queryLog?: string;
50
48
  }>;
51
49
  /**
52
50
  * Clone a table structure (with or without data)
@@ -61,7 +59,6 @@ export declare class MigrationTools {
61
59
  status: string;
62
60
  data?: any;
63
61
  error?: string;
64
- queryLog?: string;
65
62
  }>;
66
63
  /**
67
64
  * Compare structure of two tables
@@ -74,7 +71,6 @@ export declare class MigrationTools {
74
71
  status: string;
75
72
  data?: any;
76
73
  error?: string;
77
- queryLog?: string;
78
74
  }>;
79
75
  /**
80
76
  * Sync data between two tables based on a key column
@@ -91,6 +87,5 @@ export declare class MigrationTools {
91
87
  status: string;
92
88
  data?: any;
93
89
  error?: string;
94
- queryLog?: string;
95
90
  }>;
96
91
  }
@@ -80,11 +80,17 @@ class MigrationTools {
80
80
  // Validate table names
81
81
  const sourceValidation = this.security.validateIdentifier(source_table);
82
82
  if (!sourceValidation.valid) {
83
- return { status: "error", error: `Invalid source table name: ${sourceValidation.error}` };
83
+ return {
84
+ status: "error",
85
+ error: `Invalid source table name: ${sourceValidation.error}`,
86
+ };
84
87
  }
85
88
  const targetValidation = this.security.validateIdentifier(target_table);
86
89
  if (!targetValidation.valid) {
87
- return { status: "error", error: `Invalid target table name: ${targetValidation.error}` };
90
+ return {
91
+ status: "error",
92
+ error: `Invalid target table name: ${targetValidation.error}`,
93
+ };
88
94
  }
89
95
  const escapedSource = this.security.escapeIdentifier(source_table);
90
96
  const escapedTarget = this.security.escapeIdentifier(target_table);
@@ -139,7 +145,6 @@ class MigrationTools {
139
145
  source_table,
140
146
  target_table,
141
147
  },
142
- queryLog: this.db.getFormattedQueryLogs(queryCount),
143
148
  };
144
149
  }
145
150
  // Copy data in batches
@@ -177,14 +182,12 @@ class MigrationTools {
177
182
  target_table,
178
183
  truncated_target: truncate_target,
179
184
  },
180
- queryLog: this.db.getFormattedQueryLogs(queryCount),
181
185
  };
182
186
  }
183
187
  catch (error) {
184
188
  return {
185
189
  status: "error",
186
190
  error: error.message,
187
- queryLog: this.db.getFormattedQueryLogs(1),
188
191
  };
189
192
  }
190
193
  }
@@ -202,11 +205,17 @@ class MigrationTools {
202
205
  // Validate table names
203
206
  const sourceValidation = this.security.validateIdentifier(source_table);
204
207
  if (!sourceValidation.valid) {
205
- return { status: "error", error: `Invalid source table name: ${sourceValidation.error}` };
208
+ return {
209
+ status: "error",
210
+ error: `Invalid source table name: ${sourceValidation.error}`,
211
+ };
206
212
  }
207
213
  const targetValidation = this.security.validateIdentifier(target_table);
208
214
  if (!targetValidation.valid) {
209
- return { status: "error", error: `Invalid target table name: ${targetValidation.error}` };
215
+ return {
216
+ status: "error",
217
+ error: `Invalid target table name: ${targetValidation.error}`,
218
+ };
210
219
  }
211
220
  // First, copy the data
212
221
  const copyResult = await this.copyTableData({
@@ -238,14 +247,12 @@ class MigrationTools {
238
247
  target_table,
239
248
  rows_deleted_from_source: rowsCopied,
240
249
  },
241
- queryLog: this.db.getFormattedQueryLogs(1),
242
250
  };
243
251
  }
244
252
  catch (error) {
245
253
  return {
246
254
  status: "error",
247
255
  error: error.message,
248
- queryLog: this.db.getFormattedQueryLogs(1),
249
256
  };
250
257
  }
251
258
  }
@@ -263,11 +270,17 @@ class MigrationTools {
263
270
  // Validate table names
264
271
  const sourceValidation = this.security.validateIdentifier(source_table);
265
272
  if (!sourceValidation.valid) {
266
- return { status: "error", error: `Invalid source table name: ${sourceValidation.error}` };
273
+ return {
274
+ status: "error",
275
+ error: `Invalid source table name: ${sourceValidation.error}`,
276
+ };
267
277
  }
268
278
  const newValidation = this.security.validateIdentifier(new_table_name);
269
279
  if (!newValidation.valid) {
270
- return { status: "error", error: `Invalid new table name: ${newValidation.error}` };
280
+ return {
281
+ status: "error",
282
+ error: `Invalid new table name: ${newValidation.error}`,
283
+ };
271
284
  }
272
285
  const escapedSource = this.security.escapeIdentifier(source_table);
273
286
  const escapedNew = this.security.escapeIdentifier(new_table_name);
@@ -313,14 +326,12 @@ class MigrationTools {
313
326
  include_indexes,
314
327
  rows_copied: rowCount,
315
328
  },
316
- queryLog: this.db.getFormattedQueryLogs(queryCount),
317
329
  };
318
330
  }
319
331
  catch (error) {
320
332
  return {
321
333
  status: "error",
322
334
  error: error.message,
323
- queryLog: this.db.getFormattedQueryLogs(1),
324
335
  };
325
336
  }
326
337
  }
@@ -338,11 +349,17 @@ class MigrationTools {
338
349
  // Validate table names
339
350
  const table1Validation = this.security.validateIdentifier(table1);
340
351
  if (!table1Validation.valid) {
341
- return { status: "error", error: `Invalid table1 name: ${table1Validation.error}` };
352
+ return {
353
+ status: "error",
354
+ error: `Invalid table1 name: ${table1Validation.error}`,
355
+ };
342
356
  }
343
357
  const table2Validation = this.security.validateIdentifier(table2);
344
358
  if (!table2Validation.valid) {
345
- return { status: "error", error: `Invalid table2 name: ${table2Validation.error}` };
359
+ return {
360
+ status: "error",
361
+ error: `Invalid table2 name: ${table2Validation.error}`,
362
+ };
346
363
  }
347
364
  const escapedTable1 = this.security.escapeIdentifier(table1);
348
365
  const escapedTable2 = this.security.escapeIdentifier(table2);
@@ -372,8 +389,18 @@ class MigrationTools {
372
389
  col1.Default !== col2.Default) {
373
390
  different.push({
374
391
  column: name,
375
- table1: { type: col1.Type, nullable: col1.Null, key: col1.Key, default: col1.Default },
376
- table2: { type: col2.Type, nullable: col2.Null, key: col2.Key, default: col2.Default },
392
+ table1: {
393
+ type: col1.Type,
394
+ nullable: col1.Null,
395
+ key: col1.Key,
396
+ default: col1.Default,
397
+ },
398
+ table2: {
399
+ type: col2.Type,
400
+ nullable: col2.Null,
401
+ key: col2.Key,
402
+ default: col2.Default,
403
+ },
377
404
  });
378
405
  }
379
406
  else {
@@ -407,14 +434,12 @@ class MigrationTools {
407
434
  different_count: different.length,
408
435
  },
409
436
  },
410
- queryLog: this.db.getFormattedQueryLogs(queryCount),
411
437
  };
412
438
  }
413
439
  catch (error) {
414
440
  return {
415
441
  status: "error",
416
442
  error: error.message,
417
- queryLog: this.db.getFormattedQueryLogs(1),
418
443
  };
419
444
  }
420
445
  }
@@ -432,15 +457,24 @@ class MigrationTools {
432
457
  // Validate identifiers
433
458
  const sourceValidation = this.security.validateIdentifier(source_table);
434
459
  if (!sourceValidation.valid) {
435
- return { status: "error", error: `Invalid source table: ${sourceValidation.error}` };
460
+ return {
461
+ status: "error",
462
+ error: `Invalid source table: ${sourceValidation.error}`,
463
+ };
436
464
  }
437
465
  const targetValidation = this.security.validateIdentifier(target_table);
438
466
  if (!targetValidation.valid) {
439
- return { status: "error", error: `Invalid target table: ${targetValidation.error}` };
467
+ return {
468
+ status: "error",
469
+ error: `Invalid target table: ${targetValidation.error}`,
470
+ };
440
471
  }
441
472
  const keyValidation = this.security.validateIdentifier(key_column);
442
473
  if (!keyValidation.valid) {
443
- return { status: "error", error: `Invalid key column: ${keyValidation.error}` };
474
+ return {
475
+ status: "error",
476
+ error: `Invalid key column: ${keyValidation.error}`,
477
+ };
444
478
  }
445
479
  const escapedSource = this.security.escapeIdentifier(source_table);
446
480
  const escapedTarget = this.security.escapeIdentifier(target_table);
@@ -531,14 +565,12 @@ class MigrationTools {
531
565
  rows_updated: updatedCount,
532
566
  total_source_rows: sourceData.length,
533
567
  },
534
- queryLog: this.db.getFormattedQueryLogs(queryCount),
535
568
  };
536
569
  }
537
570
  catch (error) {
538
571
  return {
539
572
  status: "error",
540
573
  error: error.message,
541
- queryLog: this.db.getFormattedQueryLogs(1),
542
574
  };
543
575
  }
544
576
  }