How to reverse-engineer a live database
Database already running, ER diagram missing? Connect with a read-only account, pull selected tables onto the canvas, and save a “source of truth” baseline.
Goal: Connect MySQL / PostgreSQL / Oracle / SQL Server and import selected tables.
Prereq: Signed-in project that can configure datasources; prefer a read-only DB user.
Note: The free Demo / public share cannot reach your private DB — self-host or use a signed-in instance.
Steps
- Open the project → menu → Reverse engineer datasource (empty state may show Reverse from datasource).
- Select or create a datasource, fill connection details, test connectivity.
- Pick schemas / tables (for large DBs, filter by prefix or allow-list first).
- Run the parse; wait for completion.
- (Strongly recommended) Save a version as the reverse baseline.
What success looks like
- Selected tables appear; FKs show as relations within supported scope.
- Comments / indexes are carried over per dialect capability.
- Connection passwords do not appear in exported model JSON.
Troubleshooting
| Symptom | Try |
|---|---|
| Connection failed | Host/port/firewall; in Compose networks use the service name, not localhost for the host machine |
| Permission errors | Use a read-only account with dictionary privileges |
| Too many tables / timeouts | Narrow selection; reverse by schema or prefix batches |
| Missing indexes or FKs | Read parse hints; some dialect features are skipped, not invented |
| No reverse entry on Demo | Expected — self-host or a signed-in instance. The public Demo is not a PAT |
Agent just called create_version | Open the same version diff, accept or roll back. Pick prompt suggest-erd-version. API 200 is not human approval |
Next
- File-only / no JDBC: Import DBML
- Let Cursor suggest a version (you still diff): MCP guide — prompt
suggest-erd-version - Secrets isolation: Security model
- Start here