AI Schema Analysis: How Suggestions Are Generated
AI is the fourth tab in the mode switcher, alongside DDL/Diagram/Discovery. Clicking Run AI Analysis calls the /api/analyze endpoint, which requires a GEMINI_API_KEY to be configured on the server — if it isn’t, the mode shows a clear “needs key” message instead of failing silently.
What gets sent, and what comes back
The endpoint sends a summarized version of your schema (tables, columns, primary keys, foreign keys) plus the gaps already detected structurally, and asks Gemini for a handful of additional findings beyond what structural detection already caught — naming issues, normalization concerns, missing composite indexes, and similar design smells. The response is merged with the structural gaps into a single unified checklist, so you review one list instead of two.
The three structural gap types
Every task carries a severity, inherited from how it was detected:
- HIGH — an inferred relationship (by naming convention) with no formal foreign key constraint backing it
- MED — a foreign key column with no matching index
- LOW — an orphan table with no relationships at all
AI-sourced findings are tagged “AI Insight” and given their own severity by Gemini; structural findings are tagged “Structural”. Both appear in the same list, sorted HIGH → MED → LOW.
Reading the checklist
The pane splits into a checklist column (checkbox, severity badge, source badge, and a truncated title per row) and a Discovery-style Inspector on the right — hover a row for a transient detail view, click to pin it, mirroring the same hover/pin pattern used in Discovery mode. A filter bar above the list lets you narrow by source (All / Structural / AI Insight) and toggle each severity level independently.
Every task is selected by default. Once you’ve narrowed the list to what you actually want to act on, continue to Applying AI-Suggested Fixes.