> For the complete documentation index, see [llms.txt](https://docs.riff.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.riff.ai/reference/app-builder/database.md).

# Database

Every Riff app includes a built-in PostgreSQL database. The Database tab lets you browse your tables and inspect rows. The Riff agent can interact with the database directly on your behalf.

## What you can see

<table><thead><tr><th width="204.00775146484375">Capability</th><th>Detail</th></tr></thead><tbody><tr><td>Table browser</td><td>View all tables in your database</td></tr><tr><td>Data inspection</td><td>Browse rows in any table — useful for verifying data your app has written</td></tr><tr><td>Environment switcher</td><td>Toggle between your development (Workspace) and production (Deployed) database</td></tr></tbody></table>

## What the Riff agent can do

The Riff agent has direct tools to work with your database. You can ask it to:

* **Create records** — "Add ten sample purchase orders to the database so I can test the dashboard"
* **Read and analyse data** — "How many invoices are in an open state right now?" or "Show me the last 5 supplier records that were updated"
* **Update records** — "Set the status of PO-1042 to Confirmed"
* **Delete records** — "Remove the test data we created earlier"
* **Generate synthetic data** — "Populate the supplier table with 20 realistic test entries"

This means you rarely need to write SQL yourself. Ask the Riff agent what you need and it will handle the database interaction.

## Notes

* The tab shows your **development database** by default. Switch to production using the environment dropdown when you need to inspect live data.
* All schema changes (adding tables, columns, migrations) should be done by asking the Riff agent — it creates version-controlled migrations automatically.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.riff.ai/reference/app-builder/database.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
