You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-2Lines changed: 41 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ LLM/AI coding assistants are very good in writing code/SQL queries. But they are
12
12
13
13
Some PostgreSQL MCP server ask you for the database connection. And to perform the administrative tasks you might need SUPERUSER permission. But that's like asking for problem.
14
14
15
-
16
15
We've already seen where this leads: [production databases wiped by AI agents](https://fortune.com/2025/07/23/ai-coding-tool-replit-wiped-database-called-it-a-catastrophic-failure/), and [SQL injection in MCP servers](https://securitylabs.datadoghq.com/articles/mcp-vulnerability-case-study-SQL-injection-in-the-postgresql-mcp-server/) that were supposed to be read-only.
17
16
18
17
The model doesn't need to *query* your database. It needs to *understand* your schema: the structure, constraints, statistics, and version-specific behavior. That knowledge is structural. It changes when you deploy a migration, not between queries.
@@ -107,7 +106,7 @@ If you can connect to a PostgreSQL instance (local, dev, or production), one com
107
106
dryrun init --db "$DATABASE_URL"
108
107
```
109
108
110
-
This creates `dryrun.toml`, the `.dryrun/` data directory, and introspects the database into `.dryrun/schema.json`. You're ready to go.
109
+
This creates `dryrun.toml` (with `[project] id` and default profile), the `.dryrun/` data directory, and introspects the database into `.dryrun/schema.json`. Snapshots are keyed by `(project_id, database_id)`; set `database_id` per profile when a project has multiple databases (e.g. `auth`, `billing`). See [`docs/dryrun-toml.md`](docs/dryrun-toml.md) for the full config reference.
111
110
112
111
### Option B: Someone else has database access
113
112
@@ -134,6 +133,44 @@ dryrun lint
134
133
135
134
All commands work offline from the schema file. Each project has its own `dryrun.toml` and `.dryrun/`, there is no global state. Add `.dryrun/` to your `.gitignore`.
136
135
136
+
### Multiple databases per project
137
+
138
+
`dryrun snapshot take` keys snapshots by `(project_id, database_id)`. The defaults work — `project_id` is your folder name, `database_id` is the actual database name from `current_database()`:
139
+
140
+
```sh
141
+
dryrun init --db "$AUTH_DB"# captures auth
142
+
dryrun snapshot take --db "$BILLING_DB"# captures billing into its own stream
143
+
dryrun snapshot list --db "$AUTH_DB"# only auth snapshots
144
+
```
145
+
146
+
For stable refs (and so `list` / `diff` can run without retyping URLs), declare profiles in `dryrun.toml`:
147
+
148
+
```toml
149
+
[project]
150
+
id = "myapp"
151
+
152
+
[profiles.auth]
153
+
db_url = "${AUTH_DATABASE_URL}"
154
+
database_id = "auth"
155
+
156
+
[profiles.billing]
157
+
db_url = "${BILLING_DATABASE_URL}"
158
+
database_id = "billing"
159
+
```
160
+
161
+
Then:
162
+
163
+
```sh
164
+
dryrun --profile billing snapshot list
165
+
dryrun --profile billing snapshot diff --latest
166
+
```
167
+
168
+
See [`docs/dryrun-toml.md`](docs/dryrun-toml.md) for all profile options.
169
+
170
+
Every DB-related command (`init`, `import`, `probe`, `dump-schema`, `lint`, `drift`, `stats apply`, all `snapshot` subcommands) accepts `--profile` and falls back to the resolved profile's `db_url` and `schema_file` when the corresponding CLI flag is not provider.
171
+
172
+
> **Note:** the MCP server is currently single-database. Using the default profile. Or the option is to run one `dryrun mcp-serve` process per database. Native multi-database support inside one MCP process is tracked in [#4](https://github.com/boringSQL/dryrun/issues/7).
173
+
137
174
## MCP server
138
175
139
176
Add `dryrun` to your AI assistant. If you installed via Homebrew, `dryrun` is already on your PATH:
That's it. The server auto-discovers `.dryrun/schema.json` in the current project. No database credentials needed, your AI assistant gets full schema intelligence from the offline snapshot.
152
189
190
+
For projects with multiple databases, run one `dryrun mcp-serve` per database and add an entry per server in your client config. Native multi-database serving inside one MCP process is tracked in [#4](https://github.com/boringSQL/dryrun/issues/4).
191
+
153
192
See the [Tutorial](TUTORIAL.md) for live database setup, SSE transport, and Claude Desktop configuration.
0 commit comments