@berthojoris/mcp-mysql-server 1.7.0 → 1.9.0
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/DOCUMENTATIONS.md +797 -33
- package/README.md +400 -138
- package/dist/config/featureConfig.js +16 -0
- package/dist/index.d.ts +180 -0
- package/dist/index.js +133 -0
- package/dist/mcp-server.js +421 -0
- package/dist/tools/migrationTools.d.ts +96 -0
- package/dist/tools/migrationTools.js +546 -0
- package/dist/tools/schemaVersioningTools.d.ts +147 -0
- package/dist/tools/schemaVersioningTools.js +1007 -0
- package/package.json +2 -2
package/dist/mcp-server.js
CHANGED
|
@@ -2181,6 +2181,383 @@ const TOOLS = [
|
|
|
2181
2181
|
required: ["table_name", "json_data"],
|
|
2182
2182
|
},
|
|
2183
2183
|
},
|
|
2184
|
+
// Data Migration Tools
|
|
2185
|
+
{
|
|
2186
|
+
name: "copy_table_data",
|
|
2187
|
+
description: "Copy data from one table to another with optional column mapping and filtering. Requires 'create' permission.",
|
|
2188
|
+
inputSchema: {
|
|
2189
|
+
type: "object",
|
|
2190
|
+
properties: {
|
|
2191
|
+
source_table: {
|
|
2192
|
+
type: "string",
|
|
2193
|
+
description: "Name of the source table to copy from",
|
|
2194
|
+
},
|
|
2195
|
+
target_table: {
|
|
2196
|
+
type: "string",
|
|
2197
|
+
description: "Name of the target table to copy to",
|
|
2198
|
+
},
|
|
2199
|
+
column_mapping: {
|
|
2200
|
+
type: "object",
|
|
2201
|
+
description: "Optional: map source columns to target columns {source_col: target_col}",
|
|
2202
|
+
additionalProperties: { type: "string" },
|
|
2203
|
+
},
|
|
2204
|
+
filters: {
|
|
2205
|
+
type: "array",
|
|
2206
|
+
description: "Optional: array of filter conditions for source data",
|
|
2207
|
+
items: {
|
|
2208
|
+
type: "object",
|
|
2209
|
+
properties: {
|
|
2210
|
+
field: { type: "string" },
|
|
2211
|
+
operator: {
|
|
2212
|
+
type: "string",
|
|
2213
|
+
enum: ["eq", "neq", "gt", "gte", "lt", "lte", "like", "in"],
|
|
2214
|
+
},
|
|
2215
|
+
value: {},
|
|
2216
|
+
},
|
|
2217
|
+
required: ["field", "operator", "value"],
|
|
2218
|
+
},
|
|
2219
|
+
},
|
|
2220
|
+
batch_size: {
|
|
2221
|
+
type: "number",
|
|
2222
|
+
description: "Number of rows per batch insert (default: 1000)",
|
|
2223
|
+
},
|
|
2224
|
+
database: {
|
|
2225
|
+
type: "string",
|
|
2226
|
+
description: "Optional: specific database name",
|
|
2227
|
+
},
|
|
2228
|
+
},
|
|
2229
|
+
required: ["source_table", "target_table"],
|
|
2230
|
+
},
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
name: "move_table_data",
|
|
2234
|
+
description: "Move data from one table to another (copy then delete from source). Requires 'create' and 'delete' permissions.",
|
|
2235
|
+
inputSchema: {
|
|
2236
|
+
type: "object",
|
|
2237
|
+
properties: {
|
|
2238
|
+
source_table: {
|
|
2239
|
+
type: "string",
|
|
2240
|
+
description: "Name of the source table to move from",
|
|
2241
|
+
},
|
|
2242
|
+
target_table: {
|
|
2243
|
+
type: "string",
|
|
2244
|
+
description: "Name of the target table to move to",
|
|
2245
|
+
},
|
|
2246
|
+
column_mapping: {
|
|
2247
|
+
type: "object",
|
|
2248
|
+
description: "Optional: map source columns to target columns {source_col: target_col}",
|
|
2249
|
+
additionalProperties: { type: "string" },
|
|
2250
|
+
},
|
|
2251
|
+
filters: {
|
|
2252
|
+
type: "array",
|
|
2253
|
+
description: "Optional: array of filter conditions for source data",
|
|
2254
|
+
items: {
|
|
2255
|
+
type: "object",
|
|
2256
|
+
properties: {
|
|
2257
|
+
field: { type: "string" },
|
|
2258
|
+
operator: {
|
|
2259
|
+
type: "string",
|
|
2260
|
+
enum: ["eq", "neq", "gt", "gte", "lt", "lte", "like", "in"],
|
|
2261
|
+
},
|
|
2262
|
+
value: {},
|
|
2263
|
+
},
|
|
2264
|
+
required: ["field", "operator", "value"],
|
|
2265
|
+
},
|
|
2266
|
+
},
|
|
2267
|
+
batch_size: {
|
|
2268
|
+
type: "number",
|
|
2269
|
+
description: "Number of rows per batch (default: 1000)",
|
|
2270
|
+
},
|
|
2271
|
+
database: {
|
|
2272
|
+
type: "string",
|
|
2273
|
+
description: "Optional: specific database name",
|
|
2274
|
+
},
|
|
2275
|
+
},
|
|
2276
|
+
required: ["source_table", "target_table"],
|
|
2277
|
+
},
|
|
2278
|
+
},
|
|
2279
|
+
{
|
|
2280
|
+
name: "clone_table",
|
|
2281
|
+
description: "Clone a table structure with optional data. Requires 'ddl' permission.",
|
|
2282
|
+
inputSchema: {
|
|
2283
|
+
type: "object",
|
|
2284
|
+
properties: {
|
|
2285
|
+
source_table: {
|
|
2286
|
+
type: "string",
|
|
2287
|
+
description: "Name of the source table to clone",
|
|
2288
|
+
},
|
|
2289
|
+
new_table_name: {
|
|
2290
|
+
type: "string",
|
|
2291
|
+
description: "Name of the new table to create",
|
|
2292
|
+
},
|
|
2293
|
+
include_data: {
|
|
2294
|
+
type: "boolean",
|
|
2295
|
+
description: "Include table data in the clone (default: false)",
|
|
2296
|
+
},
|
|
2297
|
+
include_indexes: {
|
|
2298
|
+
type: "boolean",
|
|
2299
|
+
description: "Include indexes in the clone (default: true)",
|
|
2300
|
+
},
|
|
2301
|
+
database: {
|
|
2302
|
+
type: "string",
|
|
2303
|
+
description: "Optional: specific database name",
|
|
2304
|
+
},
|
|
2305
|
+
},
|
|
2306
|
+
required: ["source_table", "new_table_name"],
|
|
2307
|
+
},
|
|
2308
|
+
},
|
|
2309
|
+
{
|
|
2310
|
+
name: "compare_table_structure",
|
|
2311
|
+
description: "Compare the structure of two tables and identify differences in columns, types, and indexes.",
|
|
2312
|
+
inputSchema: {
|
|
2313
|
+
type: "object",
|
|
2314
|
+
properties: {
|
|
2315
|
+
table1: {
|
|
2316
|
+
type: "string",
|
|
2317
|
+
description: "Name of the first table",
|
|
2318
|
+
},
|
|
2319
|
+
table2: {
|
|
2320
|
+
type: "string",
|
|
2321
|
+
description: "Name of the second table",
|
|
2322
|
+
},
|
|
2323
|
+
database: {
|
|
2324
|
+
type: "string",
|
|
2325
|
+
description: "Optional: specific database name",
|
|
2326
|
+
},
|
|
2327
|
+
},
|
|
2328
|
+
required: ["table1", "table2"],
|
|
2329
|
+
},
|
|
2330
|
+
},
|
|
2331
|
+
{
|
|
2332
|
+
name: "sync_table_data",
|
|
2333
|
+
description: "Synchronize data between two tables based on a key column. Supports insert-only, update-only, or upsert modes.",
|
|
2334
|
+
inputSchema: {
|
|
2335
|
+
type: "object",
|
|
2336
|
+
properties: {
|
|
2337
|
+
source_table: {
|
|
2338
|
+
type: "string",
|
|
2339
|
+
description: "Name of the source table",
|
|
2340
|
+
},
|
|
2341
|
+
target_table: {
|
|
2342
|
+
type: "string",
|
|
2343
|
+
description: "Name of the target table",
|
|
2344
|
+
},
|
|
2345
|
+
key_column: {
|
|
2346
|
+
type: "string",
|
|
2347
|
+
description: "Primary key or unique column to match records",
|
|
2348
|
+
},
|
|
2349
|
+
columns_to_sync: {
|
|
2350
|
+
type: "array",
|
|
2351
|
+
items: { type: "string" },
|
|
2352
|
+
description: "Optional: specific columns to sync (default: all columns)",
|
|
2353
|
+
},
|
|
2354
|
+
sync_mode: {
|
|
2355
|
+
type: "string",
|
|
2356
|
+
enum: ["insert_only", "update_only", "upsert"],
|
|
2357
|
+
description: "Sync mode: insert_only (new records), update_only (existing), upsert (both). Default: upsert",
|
|
2358
|
+
},
|
|
2359
|
+
batch_size: {
|
|
2360
|
+
type: "number",
|
|
2361
|
+
description: "Number of rows per batch (default: 1000)",
|
|
2362
|
+
},
|
|
2363
|
+
database: {
|
|
2364
|
+
type: "string",
|
|
2365
|
+
description: "Optional: specific database name",
|
|
2366
|
+
},
|
|
2367
|
+
},
|
|
2368
|
+
required: ["source_table", "target_table", "key_column"],
|
|
2369
|
+
},
|
|
2370
|
+
},
|
|
2371
|
+
// Schema Versioning and Migrations Tools
|
|
2372
|
+
{
|
|
2373
|
+
name: "init_migrations_table",
|
|
2374
|
+
description: "Initialize the migrations tracking table (_schema_migrations) for schema versioning. Creates the table if it doesn't exist.",
|
|
2375
|
+
inputSchema: {
|
|
2376
|
+
type: "object",
|
|
2377
|
+
properties: {
|
|
2378
|
+
database: {
|
|
2379
|
+
type: "string",
|
|
2380
|
+
description: "Optional: specific database name",
|
|
2381
|
+
},
|
|
2382
|
+
},
|
|
2383
|
+
},
|
|
2384
|
+
},
|
|
2385
|
+
{
|
|
2386
|
+
name: "create_migration",
|
|
2387
|
+
description: "Create a new migration entry with up and down SQL. The migration will be stored as pending until applied. Requires 'ddl' permission.",
|
|
2388
|
+
inputSchema: {
|
|
2389
|
+
type: "object",
|
|
2390
|
+
properties: {
|
|
2391
|
+
name: {
|
|
2392
|
+
type: "string",
|
|
2393
|
+
description: "Name of the migration (e.g., 'add_users_table', 'add_email_column')",
|
|
2394
|
+
},
|
|
2395
|
+
up_sql: {
|
|
2396
|
+
type: "string",
|
|
2397
|
+
description: "SQL statements to apply the migration (can contain multiple statements separated by semicolons)",
|
|
2398
|
+
},
|
|
2399
|
+
down_sql: {
|
|
2400
|
+
type: "string",
|
|
2401
|
+
description: "SQL statements to rollback the migration (optional but recommended)",
|
|
2402
|
+
},
|
|
2403
|
+
description: {
|
|
2404
|
+
type: "string",
|
|
2405
|
+
description: "Optional description of what this migration does",
|
|
2406
|
+
},
|
|
2407
|
+
version: {
|
|
2408
|
+
type: "string",
|
|
2409
|
+
description: "Optional: custom version string (14 chars, e.g., '20240115120000'). Auto-generated if not provided.",
|
|
2410
|
+
},
|
|
2411
|
+
database: {
|
|
2412
|
+
type: "string",
|
|
2413
|
+
description: "Optional: specific database name",
|
|
2414
|
+
},
|
|
2415
|
+
},
|
|
2416
|
+
required: ["name", "up_sql"],
|
|
2417
|
+
},
|
|
2418
|
+
},
|
|
2419
|
+
{
|
|
2420
|
+
name: "apply_migrations",
|
|
2421
|
+
description: "Apply all pending migrations or up to a specific version. Executes migrations in version order. Requires 'ddl' permission.",
|
|
2422
|
+
inputSchema: {
|
|
2423
|
+
type: "object",
|
|
2424
|
+
properties: {
|
|
2425
|
+
target_version: {
|
|
2426
|
+
type: "string",
|
|
2427
|
+
description: "Optional: apply migrations up to this version (inclusive)",
|
|
2428
|
+
},
|
|
2429
|
+
dry_run: {
|
|
2430
|
+
type: "boolean",
|
|
2431
|
+
description: "If true, show what would be applied without executing (default: false)",
|
|
2432
|
+
},
|
|
2433
|
+
database: {
|
|
2434
|
+
type: "string",
|
|
2435
|
+
description: "Optional: specific database name",
|
|
2436
|
+
},
|
|
2437
|
+
},
|
|
2438
|
+
},
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
name: "rollback_migration",
|
|
2442
|
+
description: "Rollback applied migrations. Can rollback by steps or to a specific version. Requires 'ddl' permission.",
|
|
2443
|
+
inputSchema: {
|
|
2444
|
+
type: "object",
|
|
2445
|
+
properties: {
|
|
2446
|
+
target_version: {
|
|
2447
|
+
type: "string",
|
|
2448
|
+
description: "Optional: rollback to this version (exclusive - this version will remain applied)",
|
|
2449
|
+
},
|
|
2450
|
+
steps: {
|
|
2451
|
+
type: "number",
|
|
2452
|
+
description: "Number of migrations to rollback (default: 1). Ignored if target_version is specified.",
|
|
2453
|
+
},
|
|
2454
|
+
dry_run: {
|
|
2455
|
+
type: "boolean",
|
|
2456
|
+
description: "If true, show what would be rolled back without executing (default: false)",
|
|
2457
|
+
},
|
|
2458
|
+
database: {
|
|
2459
|
+
type: "string",
|
|
2460
|
+
description: "Optional: specific database name",
|
|
2461
|
+
},
|
|
2462
|
+
},
|
|
2463
|
+
},
|
|
2464
|
+
},
|
|
2465
|
+
{
|
|
2466
|
+
name: "get_migration_status",
|
|
2467
|
+
description: "Get migration history and status. Shows all migrations with their current status, execution times, and any errors.",
|
|
2468
|
+
inputSchema: {
|
|
2469
|
+
type: "object",
|
|
2470
|
+
properties: {
|
|
2471
|
+
version: {
|
|
2472
|
+
type: "string",
|
|
2473
|
+
description: "Optional: get status of a specific version",
|
|
2474
|
+
},
|
|
2475
|
+
status: {
|
|
2476
|
+
type: "string",
|
|
2477
|
+
enum: ["pending", "applied", "failed", "rolled_back"],
|
|
2478
|
+
description: "Optional: filter by status",
|
|
2479
|
+
},
|
|
2480
|
+
limit: {
|
|
2481
|
+
type: "number",
|
|
2482
|
+
description: "Maximum number of migrations to return (default: 50)",
|
|
2483
|
+
},
|
|
2484
|
+
database: {
|
|
2485
|
+
type: "string",
|
|
2486
|
+
description: "Optional: specific database name",
|
|
2487
|
+
},
|
|
2488
|
+
},
|
|
2489
|
+
},
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
name: "get_schema_version",
|
|
2493
|
+
description: "Get the current schema version (the last successfully applied migration).",
|
|
2494
|
+
inputSchema: {
|
|
2495
|
+
type: "object",
|
|
2496
|
+
properties: {
|
|
2497
|
+
database: {
|
|
2498
|
+
type: "string",
|
|
2499
|
+
description: "Optional: specific database name",
|
|
2500
|
+
},
|
|
2501
|
+
},
|
|
2502
|
+
},
|
|
2503
|
+
},
|
|
2504
|
+
{
|
|
2505
|
+
name: "validate_migrations",
|
|
2506
|
+
description: "Validate all migrations for issues such as duplicate versions, missing down_sql, checksum mismatches, or blocked migrations.",
|
|
2507
|
+
inputSchema: {
|
|
2508
|
+
type: "object",
|
|
2509
|
+
properties: {
|
|
2510
|
+
database: {
|
|
2511
|
+
type: "string",
|
|
2512
|
+
description: "Optional: specific database name",
|
|
2513
|
+
},
|
|
2514
|
+
},
|
|
2515
|
+
},
|
|
2516
|
+
},
|
|
2517
|
+
{
|
|
2518
|
+
name: "reset_failed_migration",
|
|
2519
|
+
description: "Reset a failed migration back to pending status so it can be retried. Only works for migrations in 'failed' status.",
|
|
2520
|
+
inputSchema: {
|
|
2521
|
+
type: "object",
|
|
2522
|
+
properties: {
|
|
2523
|
+
version: {
|
|
2524
|
+
type: "string",
|
|
2525
|
+
description: "Version of the failed migration to reset",
|
|
2526
|
+
},
|
|
2527
|
+
database: {
|
|
2528
|
+
type: "string",
|
|
2529
|
+
description: "Optional: specific database name",
|
|
2530
|
+
},
|
|
2531
|
+
},
|
|
2532
|
+
required: ["version"],
|
|
2533
|
+
},
|
|
2534
|
+
},
|
|
2535
|
+
{
|
|
2536
|
+
name: "generate_migration_from_diff",
|
|
2537
|
+
description: "Generate a migration by comparing two table structures. Creates up_sql to transform table2 to match table1, and down_sql to revert. Requires 'ddl' permission.",
|
|
2538
|
+
inputSchema: {
|
|
2539
|
+
type: "object",
|
|
2540
|
+
properties: {
|
|
2541
|
+
table1: {
|
|
2542
|
+
type: "string",
|
|
2543
|
+
description: "Source table (the structure to match)",
|
|
2544
|
+
},
|
|
2545
|
+
table2: {
|
|
2546
|
+
type: "string",
|
|
2547
|
+
description: "Target table (the table to be modified)",
|
|
2548
|
+
},
|
|
2549
|
+
migration_name: {
|
|
2550
|
+
type: "string",
|
|
2551
|
+
description: "Name for the generated migration",
|
|
2552
|
+
},
|
|
2553
|
+
database: {
|
|
2554
|
+
type: "string",
|
|
2555
|
+
description: "Optional: specific database name",
|
|
2556
|
+
},
|
|
2557
|
+
},
|
|
2558
|
+
required: ["table1", "table2", "migration_name"],
|
|
2559
|
+
},
|
|
2560
|
+
},
|
|
2184
2561
|
];
|
|
2185
2562
|
// Create the MCP server
|
|
2186
2563
|
const server = new index_js_1.Server({
|
|
@@ -2503,6 +2880,50 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
2503
2880
|
case "import_from_json":
|
|
2504
2881
|
result = await mysqlMCP.importFromJSON((args || {}));
|
|
2505
2882
|
break;
|
|
2883
|
+
// Data Migration Tools
|
|
2884
|
+
case "copy_table_data":
|
|
2885
|
+
result = await mysqlMCP.copyTableData((args || {}));
|
|
2886
|
+
break;
|
|
2887
|
+
case "move_table_data":
|
|
2888
|
+
result = await mysqlMCP.moveTableData((args || {}));
|
|
2889
|
+
break;
|
|
2890
|
+
case "clone_table":
|
|
2891
|
+
result = await mysqlMCP.cloneTable((args || {}));
|
|
2892
|
+
break;
|
|
2893
|
+
case "compare_table_structure":
|
|
2894
|
+
result = await mysqlMCP.compareTableStructure((args || {}));
|
|
2895
|
+
break;
|
|
2896
|
+
case "sync_table_data":
|
|
2897
|
+
result = await mysqlMCP.syncTableData((args || {}));
|
|
2898
|
+
break;
|
|
2899
|
+
// Schema Versioning and Migrations Tools
|
|
2900
|
+
case "init_migrations_table":
|
|
2901
|
+
result = await mysqlMCP.initMigrationsTable((args || {}));
|
|
2902
|
+
break;
|
|
2903
|
+
case "create_migration":
|
|
2904
|
+
result = await mysqlMCP.createMigration((args || {}));
|
|
2905
|
+
break;
|
|
2906
|
+
case "apply_migrations":
|
|
2907
|
+
result = await mysqlMCP.applyMigrations((args || {}));
|
|
2908
|
+
break;
|
|
2909
|
+
case "rollback_migration":
|
|
2910
|
+
result = await mysqlMCP.rollbackMigration((args || {}));
|
|
2911
|
+
break;
|
|
2912
|
+
case "get_migration_status":
|
|
2913
|
+
result = await mysqlMCP.getMigrationStatus((args || {}));
|
|
2914
|
+
break;
|
|
2915
|
+
case "get_schema_version":
|
|
2916
|
+
result = await mysqlMCP.getSchemaVersion((args || {}));
|
|
2917
|
+
break;
|
|
2918
|
+
case "validate_migrations":
|
|
2919
|
+
result = await mysqlMCP.validateMigrations((args || {}));
|
|
2920
|
+
break;
|
|
2921
|
+
case "reset_failed_migration":
|
|
2922
|
+
result = await mysqlMCP.resetFailedMigration((args || {}));
|
|
2923
|
+
break;
|
|
2924
|
+
case "generate_migration_from_diff":
|
|
2925
|
+
result = await mysqlMCP.generateMigrationFromDiff((args || {}));
|
|
2926
|
+
break;
|
|
2506
2927
|
default:
|
|
2507
2928
|
throw new Error(`Unknown tool: ${name}`);
|
|
2508
2929
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import SecurityLayer from "../security/securityLayer";
|
|
2
|
+
/**
|
|
3
|
+
* Data Migration Tools for MySQL MCP Server
|
|
4
|
+
* Provides utilities for copying, moving, and transforming data between tables
|
|
5
|
+
*/
|
|
6
|
+
export declare class MigrationTools {
|
|
7
|
+
private db;
|
|
8
|
+
private security;
|
|
9
|
+
constructor(security: SecurityLayer);
|
|
10
|
+
/**
|
|
11
|
+
* Validate database access
|
|
12
|
+
*/
|
|
13
|
+
private validateDatabaseAccess;
|
|
14
|
+
/**
|
|
15
|
+
* Escape string value for SQL
|
|
16
|
+
*/
|
|
17
|
+
private escapeValue;
|
|
18
|
+
/**
|
|
19
|
+
* Copy data from one table to another within the same database
|
|
20
|
+
*/
|
|
21
|
+
copyTableData(params: {
|
|
22
|
+
source_table: string;
|
|
23
|
+
target_table: string;
|
|
24
|
+
column_mapping?: Record<string, string>;
|
|
25
|
+
where_clause?: string;
|
|
26
|
+
truncate_target?: boolean;
|
|
27
|
+
batch_size?: number;
|
|
28
|
+
database?: string;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
status: string;
|
|
31
|
+
data?: any;
|
|
32
|
+
error?: string;
|
|
33
|
+
queryLog?: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Move data from one table to another (copy + delete from source)
|
|
37
|
+
*/
|
|
38
|
+
moveTableData(params: {
|
|
39
|
+
source_table: string;
|
|
40
|
+
target_table: string;
|
|
41
|
+
column_mapping?: Record<string, string>;
|
|
42
|
+
where_clause?: string;
|
|
43
|
+
batch_size?: number;
|
|
44
|
+
database?: string;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
status: string;
|
|
47
|
+
data?: any;
|
|
48
|
+
error?: string;
|
|
49
|
+
queryLog?: string;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Clone a table structure (with or without data)
|
|
53
|
+
*/
|
|
54
|
+
cloneTable(params: {
|
|
55
|
+
source_table: string;
|
|
56
|
+
new_table_name: string;
|
|
57
|
+
include_data?: boolean;
|
|
58
|
+
include_indexes?: boolean;
|
|
59
|
+
database?: string;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
status: string;
|
|
62
|
+
data?: any;
|
|
63
|
+
error?: string;
|
|
64
|
+
queryLog?: string;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Compare structure of two tables
|
|
68
|
+
*/
|
|
69
|
+
compareTableStructure(params: {
|
|
70
|
+
table1: string;
|
|
71
|
+
table2: string;
|
|
72
|
+
database?: string;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
status: string;
|
|
75
|
+
data?: any;
|
|
76
|
+
error?: string;
|
|
77
|
+
queryLog?: string;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Sync data between two tables based on a key column
|
|
81
|
+
*/
|
|
82
|
+
syncTableData(params: {
|
|
83
|
+
source_table: string;
|
|
84
|
+
target_table: string;
|
|
85
|
+
key_column: string;
|
|
86
|
+
columns_to_sync?: string[];
|
|
87
|
+
sync_mode?: "insert_only" | "update_only" | "upsert";
|
|
88
|
+
batch_size?: number;
|
|
89
|
+
database?: string;
|
|
90
|
+
}): Promise<{
|
|
91
|
+
status: string;
|
|
92
|
+
data?: any;
|
|
93
|
+
error?: string;
|
|
94
|
+
queryLog?: string;
|
|
95
|
+
}>;
|
|
96
|
+
}
|