Allow users to download the database schema report

Add a new endpoint to download the database schema, and include a download button on the debug page.

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/i9LQiyj
This commit is contained in:
michaelschal committed 2025-08-12 08:42:58 +00:00
1 parent 0949386425
commit 5fe9763763
2 files changed
+178 -22

No files matched your search

+33 -17
View File
@@ -1,7 +1,7 @@
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Database, Eye, Loader2 } from "lucide-react";
import { Database, Eye, Loader2, Download } from "lucide-react";
import { useAuthUnified } from "@/hooks/useAuthUnified";
export default function DatabaseDebug() {
@@ -82,23 +82,36 @@ export default function DatabaseDebug() {
</p>
</div>
<Button
onClick={handleLogSchema}
disabled={isLoading}
className="w-full"
>
{isLoading ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Scan en cours...
</>
) : (
<>
<Database className="mr-2 h-4 w-4" />
Démarrer le Scan du Schéma
</>
<div className="flex gap-2">
<Button
onClick={handleLogSchema}
disabled={isLoading}
className="flex-1"
>
{isLoading ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Scan en cours...
</>
) : (
<>
<Database className="mr-2 h-4 w-4" />
Démarrer le Scan du Schéma
</>
)}
</Button>
{result && (
<Button
onClick={() => window.open('/api/debug/download-schema', '_blank')}
variant="outline"
className="flex-shrink-0"
>
<Download className="mr-2 h-4 w-4" />
Télécharger
</Button>
)}
</Button>
</div>
{error && (
<div className="bg-red-50 border border-red-200 rounded-lg p-4">
@@ -118,6 +131,9 @@ export default function DatabaseDebug() {
<p className="mt-2 font-medium">
📋 Consultez maintenant les logs de votre serveur pour voir le détail complet du schéma.
</p>
<p className="mt-1 text-blue-700 font-medium">
💾 Cliquez sur "Télécharger" pour obtenir le rapport complet au format fichier texte.
</p>
</div>
</div>
)}