@tejasanik/postgres-mcp-server 1.0.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/LICENSE +21 -0
- package/README.md +237 -0
- package/dist/db-manager.d.ts +25 -0
- package/dist/db-manager.d.ts.map +1 -0
- package/dist/db-manager.js +148 -0
- package/dist/db-manager.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +358 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/analysis-tools.d.ts +24 -0
- package/dist/tools/analysis-tools.d.ts.map +1 -0
- package/dist/tools/analysis-tools.js +449 -0
- package/dist/tools/analysis-tools.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +21 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/schema-tools.d.ts +22 -0
- package/dist/tools/schema-tools.d.ts.map +1 -0
- package/dist/tools/schema-tools.js +189 -0
- package/dist/tools/schema-tools.js.map +1 -0
- package/dist/tools/server-tools.d.ts +28 -0
- package/dist/tools/server-tools.d.ts.map +1 -0
- package/dist/tools/server-tools.js +71 -0
- package/dist/tools/server-tools.js.map +1 -0
- package/dist/tools/sql-tools.d.ts +17 -0
- package/dist/tools/sql-tools.d.ts.map +1 -0
- package/dist/tools/sql-tools.js +134 -0
- package/dist/tools/sql-tools.js.map +1 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTopQueries = getTopQueries;
|
|
4
|
+
exports.analyzeWorkloadIndexes = analyzeWorkloadIndexes;
|
|
5
|
+
exports.analyzeQueryIndexes = analyzeQueryIndexes;
|
|
6
|
+
exports.analyzeDbHealth = analyzeDbHealth;
|
|
7
|
+
const db_manager_js_1 = require("../db-manager.js");
|
|
8
|
+
async function getTopQueries(args) {
|
|
9
|
+
const dbManager = (0, db_manager_js_1.getDbManager)();
|
|
10
|
+
const limit = args.limit || 10;
|
|
11
|
+
const orderBy = args.orderBy || 'total_time';
|
|
12
|
+
const minCalls = args.minCalls || 1;
|
|
13
|
+
// Check if pg_stat_statements extension is available
|
|
14
|
+
const extCheck = await dbManager.query(`
|
|
15
|
+
SELECT EXISTS (
|
|
16
|
+
SELECT 1 FROM pg_extension WHERE extname = 'pg_stat_statements'
|
|
17
|
+
) as has_extension
|
|
18
|
+
`);
|
|
19
|
+
if (!extCheck.rows[0].has_extension) {
|
|
20
|
+
throw new Error('pg_stat_statements extension is not installed. Please install it to use this feature.');
|
|
21
|
+
}
|
|
22
|
+
const orderColumn = orderBy === 'total_time' ? 'total_exec_time' :
|
|
23
|
+
orderBy === 'mean_time' ? 'mean_exec_time' : 'calls';
|
|
24
|
+
const query = `
|
|
25
|
+
SELECT
|
|
26
|
+
query,
|
|
27
|
+
calls,
|
|
28
|
+
total_exec_time as total_time,
|
|
29
|
+
mean_exec_time as mean_time,
|
|
30
|
+
rows
|
|
31
|
+
FROM pg_stat_statements
|
|
32
|
+
WHERE calls >= $1
|
|
33
|
+
ORDER BY ${orderColumn} DESC
|
|
34
|
+
LIMIT $2
|
|
35
|
+
`;
|
|
36
|
+
try {
|
|
37
|
+
const result = await dbManager.query(query, [minCalls, limit]);
|
|
38
|
+
return result.rows;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
// Try older column names (PostgreSQL < 13)
|
|
42
|
+
const legacyQuery = `
|
|
43
|
+
SELECT
|
|
44
|
+
query,
|
|
45
|
+
calls,
|
|
46
|
+
total_time,
|
|
47
|
+
mean_time,
|
|
48
|
+
rows
|
|
49
|
+
FROM pg_stat_statements
|
|
50
|
+
WHERE calls >= $1
|
|
51
|
+
ORDER BY ${orderBy === 'total_time' ? 'total_time' : orderBy === 'mean_time' ? 'mean_time' : 'calls'} DESC
|
|
52
|
+
LIMIT $2
|
|
53
|
+
`;
|
|
54
|
+
const result = await dbManager.query(legacyQuery, [minCalls, limit]);
|
|
55
|
+
return result.rows;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function analyzeWorkloadIndexes(args) {
|
|
59
|
+
const dbManager = (0, db_manager_js_1.getDbManager)();
|
|
60
|
+
const topCount = args.topQueriesCount || 20;
|
|
61
|
+
// Get top slow queries
|
|
62
|
+
const slowQueries = await getTopQueries({ limit: topCount, orderBy: 'total_time' });
|
|
63
|
+
const recommendations = [];
|
|
64
|
+
// Analyze each query for potential index improvements
|
|
65
|
+
for (const query of slowQueries) {
|
|
66
|
+
const queryRecs = await analyzeQueryForIndexes(query.query);
|
|
67
|
+
recommendations.push(...queryRecs);
|
|
68
|
+
}
|
|
69
|
+
// Deduplicate recommendations
|
|
70
|
+
const uniqueRecs = deduplicateRecommendations(recommendations);
|
|
71
|
+
return {
|
|
72
|
+
queries: slowQueries,
|
|
73
|
+
recommendations: uniqueRecs
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async function analyzeQueryIndexes(args) {
|
|
77
|
+
if (args.queries.length > 10) {
|
|
78
|
+
throw new Error('Maximum 10 queries allowed per analysis');
|
|
79
|
+
}
|
|
80
|
+
const queryAnalysis = [];
|
|
81
|
+
const allRecommendations = [];
|
|
82
|
+
for (const query of args.queries) {
|
|
83
|
+
const recommendations = await analyzeQueryForIndexes(query);
|
|
84
|
+
queryAnalysis.push({ query, recommendations });
|
|
85
|
+
allRecommendations.push(...recommendations);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
queryAnalysis,
|
|
89
|
+
summary: deduplicateRecommendations(allRecommendations)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async function analyzeQueryForIndexes(query) {
|
|
93
|
+
const dbManager = (0, db_manager_js_1.getDbManager)();
|
|
94
|
+
const recommendations = [];
|
|
95
|
+
try {
|
|
96
|
+
// Get the execution plan
|
|
97
|
+
const explainResult = await dbManager.query(`EXPLAIN (FORMAT JSON) ${query}`);
|
|
98
|
+
const plan = explainResult.rows[0]['QUERY PLAN'][0];
|
|
99
|
+
// Analyze the plan for sequential scans on large tables
|
|
100
|
+
const seqScans = findSequentialScans(plan.Plan);
|
|
101
|
+
for (const scan of seqScans) {
|
|
102
|
+
// Check if there's a filter condition that could benefit from an index
|
|
103
|
+
if (scan.filter) {
|
|
104
|
+
const columns = extractColumnsFromFilter(scan.filter);
|
|
105
|
+
if (columns.length > 0) {
|
|
106
|
+
recommendations.push({
|
|
107
|
+
table: scan.table,
|
|
108
|
+
columns,
|
|
109
|
+
index_type: 'btree',
|
|
110
|
+
reason: `Sequential scan with filter on ${columns.join(', ')}. Query cost: ${scan.cost}`,
|
|
111
|
+
estimated_improvement: 'Could significantly reduce query time for filtered queries'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Check for sort operations that could use indexes
|
|
116
|
+
if (scan.sortKey) {
|
|
117
|
+
recommendations.push({
|
|
118
|
+
table: scan.table,
|
|
119
|
+
columns: [scan.sortKey],
|
|
120
|
+
index_type: 'btree',
|
|
121
|
+
reason: `Sort operation on ${scan.sortKey}`,
|
|
122
|
+
estimated_improvement: 'Could eliminate sorting overhead'
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
// Query analysis failed, skip this query
|
|
129
|
+
}
|
|
130
|
+
return recommendations;
|
|
131
|
+
}
|
|
132
|
+
function findSequentialScans(node, scans = []) {
|
|
133
|
+
if (!node)
|
|
134
|
+
return scans;
|
|
135
|
+
if (node['Node Type'] === 'Seq Scan') {
|
|
136
|
+
scans.push({
|
|
137
|
+
table: node['Relation Name'],
|
|
138
|
+
filter: node['Filter'],
|
|
139
|
+
cost: node['Total Cost'],
|
|
140
|
+
rows: node['Plan Rows']
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
if (node['Sort Key']) {
|
|
144
|
+
scans.push({
|
|
145
|
+
table: node['Relation Name'] || 'unknown',
|
|
146
|
+
sortKey: node['Sort Key'][0],
|
|
147
|
+
cost: node['Total Cost']
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
// Recursively check child nodes
|
|
151
|
+
if (node.Plans) {
|
|
152
|
+
for (const child of node.Plans) {
|
|
153
|
+
findSequentialScans(child, scans);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return scans;
|
|
157
|
+
}
|
|
158
|
+
function extractColumnsFromFilter(filter) {
|
|
159
|
+
// Simple extraction of column names from filter expressions
|
|
160
|
+
const columns = [];
|
|
161
|
+
const matches = filter.match(/\((\w+)\s*[=<>!]+/g);
|
|
162
|
+
if (matches) {
|
|
163
|
+
for (const match of matches) {
|
|
164
|
+
const col = match.match(/\((\w+)/);
|
|
165
|
+
if (col) {
|
|
166
|
+
columns.push(col[1]);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return [...new Set(columns)];
|
|
171
|
+
}
|
|
172
|
+
function deduplicateRecommendations(recommendations) {
|
|
173
|
+
const seen = new Map();
|
|
174
|
+
for (const rec of recommendations) {
|
|
175
|
+
const key = `${rec.table}:${rec.columns.sort().join(',')}:${rec.index_type}`;
|
|
176
|
+
if (!seen.has(key)) {
|
|
177
|
+
seen.set(key, rec);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return Array.from(seen.values());
|
|
181
|
+
}
|
|
182
|
+
async function analyzeDbHealth() {
|
|
183
|
+
const dbManager = (0, db_manager_js_1.getDbManager)();
|
|
184
|
+
const results = [];
|
|
185
|
+
// 1. Buffer Cache Hit Rate
|
|
186
|
+
try {
|
|
187
|
+
const cacheResult = await dbManager.query(`
|
|
188
|
+
SELECT
|
|
189
|
+
sum(heap_blks_read) as heap_read,
|
|
190
|
+
sum(heap_blks_hit) as heap_hit,
|
|
191
|
+
sum(heap_blks_hit) / NULLIF(sum(heap_blks_hit) + sum(heap_blks_read), 0) as ratio
|
|
192
|
+
FROM pg_statio_user_tables
|
|
193
|
+
`);
|
|
194
|
+
const ratio = parseFloat(cacheResult.rows[0].ratio) || 0;
|
|
195
|
+
let status = 'healthy';
|
|
196
|
+
if (ratio < 0.9)
|
|
197
|
+
status = 'warning';
|
|
198
|
+
if (ratio < 0.8)
|
|
199
|
+
status = 'critical';
|
|
200
|
+
results.push({
|
|
201
|
+
category: 'Buffer Cache Hit Rate',
|
|
202
|
+
status,
|
|
203
|
+
message: `Cache hit ratio: ${(ratio * 100).toFixed(2)}%`,
|
|
204
|
+
details: {
|
|
205
|
+
heap_read: cacheResult.rows[0].heap_read,
|
|
206
|
+
heap_hit: cacheResult.rows[0].heap_hit,
|
|
207
|
+
recommendation: ratio < 0.9 ? 'Consider increasing shared_buffers' : 'Good cache performance'
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
results.push({
|
|
213
|
+
category: 'Buffer Cache Hit Rate',
|
|
214
|
+
status: 'warning',
|
|
215
|
+
message: `Could not check buffer cache: ${error}`
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
// 2. Connection Health
|
|
219
|
+
try {
|
|
220
|
+
const connResult = await dbManager.query(`
|
|
221
|
+
SELECT
|
|
222
|
+
count(*) as total_connections,
|
|
223
|
+
count(*) FILTER (WHERE state = 'active') as active,
|
|
224
|
+
count(*) FILTER (WHERE state = 'idle') as idle,
|
|
225
|
+
count(*) FILTER (WHERE state = 'idle in transaction') as idle_in_transaction,
|
|
226
|
+
(SELECT setting::int FROM pg_settings WHERE name = 'max_connections') as max_connections
|
|
227
|
+
FROM pg_stat_activity
|
|
228
|
+
WHERE backend_type = 'client backend'
|
|
229
|
+
`);
|
|
230
|
+
const row = connResult.rows[0];
|
|
231
|
+
const usageRatio = row.total_connections / row.max_connections;
|
|
232
|
+
let status = 'healthy';
|
|
233
|
+
if (usageRatio > 0.7)
|
|
234
|
+
status = 'warning';
|
|
235
|
+
if (usageRatio > 0.9)
|
|
236
|
+
status = 'critical';
|
|
237
|
+
results.push({
|
|
238
|
+
category: 'Connection Health',
|
|
239
|
+
status,
|
|
240
|
+
message: `Using ${row.total_connections}/${row.max_connections} connections (${(usageRatio * 100).toFixed(1)}%)`,
|
|
241
|
+
details: {
|
|
242
|
+
active: row.active,
|
|
243
|
+
idle: row.idle,
|
|
244
|
+
idle_in_transaction: row.idle_in_transaction,
|
|
245
|
+
recommendation: row.idle_in_transaction > 5 ? 'Check for long-running idle transactions' : 'Connection usage healthy'
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
results.push({
|
|
251
|
+
category: 'Connection Health',
|
|
252
|
+
status: 'warning',
|
|
253
|
+
message: `Could not check connections: ${error}`
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
// 3. Invalid Indexes
|
|
257
|
+
try {
|
|
258
|
+
const indexResult = await dbManager.query(`
|
|
259
|
+
SELECT
|
|
260
|
+
schemaname,
|
|
261
|
+
tablename,
|
|
262
|
+
indexname,
|
|
263
|
+
pg_get_indexdef(i.indexrelid) as indexdef
|
|
264
|
+
FROM pg_indexes
|
|
265
|
+
JOIN pg_index i ON i.indexrelid = (schemaname || '.' || indexname)::regclass
|
|
266
|
+
WHERE NOT i.indisvalid
|
|
267
|
+
`);
|
|
268
|
+
const status = indexResult.rows.length > 0 ? 'critical' : 'healthy';
|
|
269
|
+
results.push({
|
|
270
|
+
category: 'Invalid Indexes',
|
|
271
|
+
status,
|
|
272
|
+
message: indexResult.rows.length > 0 ? `Found ${indexResult.rows.length} invalid indexes` : 'No invalid indexes found',
|
|
273
|
+
details: indexResult.rows.length > 0 ? { indexes: indexResult.rows } : undefined
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
results.push({
|
|
278
|
+
category: 'Invalid Indexes',
|
|
279
|
+
status: 'healthy',
|
|
280
|
+
message: 'No invalid indexes found'
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
// 4. Unused Indexes
|
|
284
|
+
try {
|
|
285
|
+
const unusedResult = await dbManager.query(`
|
|
286
|
+
SELECT
|
|
287
|
+
schemaname,
|
|
288
|
+
relname as tablename,
|
|
289
|
+
indexrelname as indexname,
|
|
290
|
+
idx_scan,
|
|
291
|
+
pg_size_pretty(pg_relation_size(indexrelid)) as index_size
|
|
292
|
+
FROM pg_stat_user_indexes
|
|
293
|
+
WHERE idx_scan = 0
|
|
294
|
+
AND indexrelname NOT LIKE '%_pkey'
|
|
295
|
+
AND pg_relation_size(indexrelid) > 1048576
|
|
296
|
+
ORDER BY pg_relation_size(indexrelid) DESC
|
|
297
|
+
LIMIT 20
|
|
298
|
+
`);
|
|
299
|
+
const status = unusedResult.rows.length > 5 ? 'warning' : 'healthy';
|
|
300
|
+
results.push({
|
|
301
|
+
category: 'Unused Indexes',
|
|
302
|
+
status,
|
|
303
|
+
message: unusedResult.rows.length > 0 ? `Found ${unusedResult.rows.length} potentially unused indexes (>1MB)` : 'No large unused indexes found',
|
|
304
|
+
details: unusedResult.rows.length > 0 ? { indexes: unusedResult.rows } : undefined
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
results.push({
|
|
309
|
+
category: 'Unused Indexes',
|
|
310
|
+
status: 'warning',
|
|
311
|
+
message: `Could not check unused indexes: ${error}`
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
// 5. Duplicate Indexes
|
|
315
|
+
try {
|
|
316
|
+
const dupResult = await dbManager.query(`
|
|
317
|
+
SELECT
|
|
318
|
+
pg_size_pretty(sum(pg_relation_size(idx))::bigint) as total_size,
|
|
319
|
+
array_agg(idx) as indexes,
|
|
320
|
+
(array_agg(indrelid))[1]::regclass as table_name
|
|
321
|
+
FROM (
|
|
322
|
+
SELECT indexrelid::regclass as idx,
|
|
323
|
+
indrelid,
|
|
324
|
+
indkey as columns
|
|
325
|
+
FROM pg_index
|
|
326
|
+
) sub
|
|
327
|
+
GROUP BY indrelid, columns
|
|
328
|
+
HAVING count(*) > 1
|
|
329
|
+
`);
|
|
330
|
+
const status = dupResult.rows.length > 0 ? 'warning' : 'healthy';
|
|
331
|
+
results.push({
|
|
332
|
+
category: 'Duplicate Indexes',
|
|
333
|
+
status,
|
|
334
|
+
message: dupResult.rows.length > 0 ? `Found ${dupResult.rows.length} sets of duplicate indexes` : 'No duplicate indexes found',
|
|
335
|
+
details: dupResult.rows.length > 0 ? { duplicates: dupResult.rows } : undefined
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
results.push({
|
|
340
|
+
category: 'Duplicate Indexes',
|
|
341
|
+
status: 'healthy',
|
|
342
|
+
message: 'No duplicate indexes detected'
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
// 6. Vacuum Health
|
|
346
|
+
try {
|
|
347
|
+
const vacuumResult = await dbManager.query(`
|
|
348
|
+
SELECT
|
|
349
|
+
schemaname,
|
|
350
|
+
relname,
|
|
351
|
+
n_live_tup,
|
|
352
|
+
n_dead_tup,
|
|
353
|
+
last_vacuum,
|
|
354
|
+
last_autovacuum,
|
|
355
|
+
CASE WHEN n_live_tup > 0
|
|
356
|
+
THEN round(100.0 * n_dead_tup / n_live_tup, 2)
|
|
357
|
+
ELSE 0
|
|
358
|
+
END as dead_ratio
|
|
359
|
+
FROM pg_stat_user_tables
|
|
360
|
+
WHERE n_dead_tup > 10000
|
|
361
|
+
ORDER BY n_dead_tup DESC
|
|
362
|
+
LIMIT 20
|
|
363
|
+
`);
|
|
364
|
+
let status = 'healthy';
|
|
365
|
+
const needsVacuum = vacuumResult.rows.filter((r) => r.dead_ratio > 10);
|
|
366
|
+
if (needsVacuum.length > 0)
|
|
367
|
+
status = 'warning';
|
|
368
|
+
if (needsVacuum.length > 5)
|
|
369
|
+
status = 'critical';
|
|
370
|
+
results.push({
|
|
371
|
+
category: 'Vacuum Health',
|
|
372
|
+
status,
|
|
373
|
+
message: needsVacuum.length > 0 ? `${needsVacuum.length} tables have high dead tuple ratio` : 'Vacuum status healthy',
|
|
374
|
+
details: needsVacuum.length > 0 ? { tables: needsVacuum } : undefined
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
catch (error) {
|
|
378
|
+
results.push({
|
|
379
|
+
category: 'Vacuum Health',
|
|
380
|
+
status: 'warning',
|
|
381
|
+
message: `Could not check vacuum status: ${error}`
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
// 7. Sequence Limits
|
|
385
|
+
try {
|
|
386
|
+
const seqResult = await dbManager.query(`
|
|
387
|
+
SELECT
|
|
388
|
+
schemaname,
|
|
389
|
+
sequencename,
|
|
390
|
+
last_value,
|
|
391
|
+
max_value,
|
|
392
|
+
CASE WHEN max_value > 0
|
|
393
|
+
THEN round(100.0 * last_value / max_value, 2)
|
|
394
|
+
ELSE 0
|
|
395
|
+
END as usage_percent
|
|
396
|
+
FROM pg_sequences
|
|
397
|
+
WHERE CASE WHEN max_value > 0
|
|
398
|
+
THEN 100.0 * last_value / max_value > 50
|
|
399
|
+
ELSE false
|
|
400
|
+
END
|
|
401
|
+
ORDER BY usage_percent DESC
|
|
402
|
+
`);
|
|
403
|
+
let status = 'healthy';
|
|
404
|
+
if (seqResult.rows.some((r) => r.usage_percent > 80))
|
|
405
|
+
status = 'warning';
|
|
406
|
+
if (seqResult.rows.some((r) => r.usage_percent > 95))
|
|
407
|
+
status = 'critical';
|
|
408
|
+
results.push({
|
|
409
|
+
category: 'Sequence Limits',
|
|
410
|
+
status,
|
|
411
|
+
message: seqResult.rows.length > 0 ? `${seqResult.rows.length} sequences over 50% usage` : 'All sequences have healthy headroom',
|
|
412
|
+
details: seqResult.rows.length > 0 ? { sequences: seqResult.rows } : undefined
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
results.push({
|
|
417
|
+
category: 'Sequence Limits',
|
|
418
|
+
status: 'healthy',
|
|
419
|
+
message: 'Sequences appear healthy'
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
// 8. Constraint Validation
|
|
423
|
+
try {
|
|
424
|
+
const constraintResult = await dbManager.query(`
|
|
425
|
+
SELECT
|
|
426
|
+
conname,
|
|
427
|
+
conrelid::regclass as table_name,
|
|
428
|
+
contype
|
|
429
|
+
FROM pg_constraint
|
|
430
|
+
WHERE NOT convalidated
|
|
431
|
+
`);
|
|
432
|
+
const status = constraintResult.rows.length > 0 ? 'warning' : 'healthy';
|
|
433
|
+
results.push({
|
|
434
|
+
category: 'Constraint Validation',
|
|
435
|
+
status,
|
|
436
|
+
message: constraintResult.rows.length > 0 ? `${constraintResult.rows.length} constraints not validated` : 'All constraints validated',
|
|
437
|
+
details: constraintResult.rows.length > 0 ? { constraints: constraintResult.rows } : undefined
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
results.push({
|
|
442
|
+
category: 'Constraint Validation',
|
|
443
|
+
status: 'healthy',
|
|
444
|
+
message: 'Constraints appear validated'
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
return results;
|
|
448
|
+
}
|
|
449
|
+
//# sourceMappingURL=analysis-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis-tools.js","sourceRoot":"","sources":["../../src/tools/analysis-tools.ts"],"names":[],"mappings":";;AAGA,sCAyDC;AAED,wDA4BC;AAED,kDA0BC;AAyGD,0CA+QC;AA9eD,oDAAgD;AAGzC,KAAK,UAAU,aAAa,CAAC,IAInC;IACC,MAAM,SAAS,GAAG,IAAA,4BAAY,GAAE,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,YAAY,CAAC;IAC7C,MAAM,QAAQ,G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AAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QACrG,OAAO,CAAC,IAAI,CAAC;YACX,QAAQ,EAAE,uBAAuB;YACjC,MAAM;YACN,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,4BAA4B,CAAC,CAAC,CAAC,2BAA2B;YACrI,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;SAC/F,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC;YACX,QAAQ,EAAE,uBAAuB;YACjC,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,8BAA8B;SACxC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./server-tools.js"), exports);
|
|
18
|
+
__exportStar(require("./schema-tools.js"), exports);
|
|
19
|
+
__exportStar(require("./sql-tools.js"), exports);
|
|
20
|
+
__exportStar(require("./analysis-tools.js"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,iDAA+B;AAC/B,sDAAoC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SchemaInfo, TableInfo, ColumnInfo, ConstraintInfo, IndexInfo } from '../types.js';
|
|
2
|
+
export declare function listSchemas(args: {
|
|
3
|
+
includeSystemSchemas?: boolean;
|
|
4
|
+
}): Promise<SchemaInfo[]>;
|
|
5
|
+
export declare function listObjects(args: {
|
|
6
|
+
schema: string;
|
|
7
|
+
objectType?: 'table' | 'view' | 'sequence' | 'extension' | 'all';
|
|
8
|
+
filter?: string;
|
|
9
|
+
}): Promise<TableInfo[]>;
|
|
10
|
+
export declare function getObjectDetails(args: {
|
|
11
|
+
schema: string;
|
|
12
|
+
objectName: string;
|
|
13
|
+
objectType?: 'table' | 'view' | 'sequence';
|
|
14
|
+
}): Promise<{
|
|
15
|
+
columns?: ColumnInfo[];
|
|
16
|
+
constraints?: ConstraintInfo[];
|
|
17
|
+
indexes?: IndexInfo[];
|
|
18
|
+
rowCount?: number;
|
|
19
|
+
size?: string;
|
|
20
|
+
definition?: string;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=schema-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-tools.d.ts","sourceRoot":"","sources":["../../src/tools/schema-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE3F,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAqBxB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,CAAC;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CA+EvB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;CAC5C,GAAG,OAAO,CAAC;IACV,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CAmGD"}
|