mcp-migration-advisor 0.2.8 → 0.2.9

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.
@@ -66,13 +66,17 @@ function generateRollbackStatement(stmt) {
66
66
  isReversible: true,
67
67
  warning: null,
68
68
  };
69
- case "DROP_TABLE":
69
+ case "DROP_TABLE": {
70
+ const hasCascade = stmt.details.cascade === "true";
70
71
  return {
71
72
  forward: stmt.raw,
72
73
  rollback: `-- Cannot reverse DROP TABLE ${stmt.tableName} without schema backup`,
73
74
  isReversible: false,
74
- warning: `DROP TABLE ${stmt.tableName} is irreversible — table structure and data are lost. Restore from backup.`,
75
+ warning: hasCascade
76
+ ? `DROP TABLE ${stmt.tableName} CASCADE is irreversible — table and all dependent objects (views, foreign keys, indexes) are permanently destroyed. Each dependent object must be recreated manually.`
77
+ : `DROP TABLE ${stmt.tableName} is irreversible — table structure and data are lost. Restore from backup.`,
75
78
  };
79
+ }
76
80
  case "CREATE_INDEX": {
77
81
  // Extract index name from the raw SQL
78
82
  const indexMatch = stmt.raw.match(/INDEX\s+(?:CONCURRENTLY\s+)?(?:IF\s+NOT\s+EXISTS\s+)?(?:`|"|)?(\w+)/i);
package/build/index.js CHANGED
@@ -33,7 +33,7 @@ function formatParserWarnings(migration) {
33
33
  }
34
34
  // Handle --help
35
35
  if (process.argv.includes("--help") || process.argv.includes("-h")) {
36
- console.log(`mcp-migration-advisor v0.2.8 — MCP server for database migration risk analysis
36
+ console.log(`mcp-migration-advisor v0.2.9 — MCP server for database migration risk analysis
37
37
 
38
38
  Usage:
39
39
  mcp-migration-advisor [options]
@@ -52,7 +52,7 @@ Tools provided:
52
52
  }
53
53
  const server = new McpServer({
54
54
  name: "mcp-migration-advisor",
55
- version: "0.2.8",
55
+ version: "0.2.9",
56
56
  });
57
57
  // Tool 1: analyze_migration
58
58
  server.tool("analyze_migration", "Analyze a SQL migration file for lock risks, data loss potential, and unsafe patterns. Supports Flyway (V__*.sql) and plain SQL.", {
@@ -62,7 +62,11 @@ server.tool("analyze_migration", "Analyze a SQL migration file for lock risks, d
62
62
  const migration = parseMigration(filename, sql);
63
63
  const lockRisks = analyzeLockRisks(migration);
64
64
  const dataLossIssues = analyzeDataLoss(migration);
65
- const riskScore = calculateRiskScore(lockRisks);
65
+ const lockScore = calculateRiskScore(lockRisks);
66
+ const dataLossScore = Math.min(100, dataLossIssues.filter(i => i.risk === "CERTAIN").length * 25 +
67
+ dataLossIssues.filter(i => i.risk === "LIKELY").length * 15 +
68
+ dataLossIssues.filter(i => i.risk === "POSSIBLE").length * 5);
69
+ const riskScore = Math.min(100, lockScore + dataLossScore);
66
70
  let output = `## Migration Analysis: ${filename}\n\n`;
67
71
  // Migration info
68
72
  if (migration.version) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-migration-advisor",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "MCP server for database migration risk analysis — Flyway and Liquibase XML/YAML/SQL support with lock detection and conflict analysis",
5
5
  "mcpName": "io.github.dmitriusan/mcp-migration-advisor",
6
6
  "main": "build/index.js",