mcp-migration-advisor 0.2.6 → 0.2.7
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/build/generators/rollback.js +16 -0
- package/build/index.js +6 -2
- package/package.json +1 -1
|
@@ -132,6 +132,22 @@ function generateRollbackStatement(stmt) {
|
|
|
132
132
|
warning: `Type change on ${stmt.tableName}.${stmt.columnName} requires knowing the original type. Check schema before migration.`,
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
+
if (stmt.details.setDefault === "true") {
|
|
136
|
+
return {
|
|
137
|
+
forward: stmt.raw,
|
|
138
|
+
rollback: `ALTER TABLE ${stmt.tableName} ALTER COLUMN ${stmt.columnName} DROP DEFAULT`,
|
|
139
|
+
isReversible: true,
|
|
140
|
+
warning: null,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (stmt.details.dropDefault === "true") {
|
|
144
|
+
return {
|
|
145
|
+
forward: stmt.raw,
|
|
146
|
+
rollback: `-- Cannot reverse DROP DEFAULT on ${stmt.tableName}.${stmt.columnName} — original default value unknown`,
|
|
147
|
+
isReversible: false,
|
|
148
|
+
warning: `DROP DEFAULT on ${stmt.tableName}.${stmt.columnName} requires knowing the original default value to reverse.`,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
135
151
|
return {
|
|
136
152
|
forward: stmt.raw,
|
|
137
153
|
rollback: `-- Cannot reverse: ${stmt.raw.slice(0, 80)}`,
|
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.
|
|
36
|
+
console.log(`mcp-migration-advisor v0.2.6 — 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.
|
|
55
|
+
version: "0.2.6",
|
|
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.", {
|
|
@@ -200,6 +200,8 @@ server.tool("score_risk", "Calculate the combined risk score (0-100) for a SQL m
|
|
|
200
200
|
const riskScore = calculateRiskScore(lockRisks);
|
|
201
201
|
const criticalCount = lockRisks.filter(r => r.severity === "CRITICAL").length;
|
|
202
202
|
const highCount = lockRisks.filter(r => r.severity === "HIGH").length;
|
|
203
|
+
const mediumCount = lockRisks.filter(r => r.severity === "MEDIUM").length;
|
|
204
|
+
const lowCount = lockRisks.filter(r => r.severity === "LOW").length;
|
|
203
205
|
const dataLossCertain = dataLossIssues.filter(i => i.risk === "CERTAIN").length;
|
|
204
206
|
const dataLossLikely = dataLossIssues.filter(i => i.risk === "LIKELY").length;
|
|
205
207
|
const dataLossPossible = dataLossIssues.filter(i => i.risk === "POSSIBLE").length;
|
|
@@ -226,6 +228,8 @@ server.tool("score_risk", "Calculate the combined risk score (0-100) for a SQL m
|
|
|
226
228
|
|----------|-------|--------------------|
|
|
227
229
|
| CRITICAL lock risks | ${criticalCount} | ${criticalCount * 30} |
|
|
228
230
|
| HIGH lock risks | ${highCount} | ${highCount * 20} |
|
|
231
|
+
| MEDIUM lock risks | ${mediumCount} | ${mediumCount * 10} |
|
|
232
|
+
| LOW lock risks | ${lowCount} | ${lowCount * 5} |
|
|
229
233
|
| Certain data loss | ${dataLossCertain} | ${dataLossCertain * 25} |
|
|
230
234
|
| Likely data loss | ${dataLossLikely} | ${dataLossLikely * 15} |
|
|
231
235
|
| Possible data loss | ${dataLossPossible} | ${dataLossPossible * 5} |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-migration-advisor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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",
|