Add diagnostic tools to view database schema and logs

Integrate a new database debug page for administrators to view database schema, table counts, and relationships, accessible via a new route and sidebar item.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: b163d4c0-de5e-4f4e-a9c0-aed4c7049718
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/b163d4c0-de5e-4f4e-a9c0-aed4c7049718/xTmsprA
This commit is contained in:
michaelschal committed 2025-08-12 08:03:34 +00:00
1 parent fb9bb34702
commit 4ee0fdd206
4 files changed
+170 -4

No files matched your search

+4 -4
View File
@@ -1413,7 +1413,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
ORDER BY table_name
`;
const tablesResult = await storage.db.query(tablesQuery);
const tablesResult = await (storage as any).db.query(tablesQuery);
console.log(`\n📊 TOTAL DES TABLES TROUVÉES: ${tablesResult.rows.length}`);
console.log('==========================================');
@@ -1439,7 +1439,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
ORDER BY ordinal_position
`;
const columnsResult = await storage.db.query(columnsQuery, [tableName]);
const columnsResult = await (storage as any).db.query(columnsQuery, [tableName]);
if (columnsResult.rows.length > 0) {
columnsResult.rows.forEach((col, index) => {
@@ -1453,7 +1453,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
// Compter les enregistrements dans la table
try {
const countQuery = `SELECT COUNT(*) as total FROM "${tableName}"`;
const countResult = await storage.db.query(countQuery);
const countResult = await (storage as any).db.query(countQuery);
console.log(` 📈 Nombre d'enregistrements: ${countResult.rows[0].total}`);
} catch (countError) {
console.log(` ⚠️ Impossible de compter les enregistrements: ${countError.message}`);
@@ -1484,7 +1484,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
ORDER BY tc.table_name, kcu.column_name
`;
const fkResult = await storage.db.query(fkQuery);
const fkResult = await (storage as any).db.query(fkQuery);
if (fkResult.rows.length > 0) {
fkResult.rows.forEach(fk => {