Rumatadocs
Browse documentation

Database for apps and workflows

How apps persist relational data in the factory PostgreSQL database, run SQL from workflows, enable extensions and prove persistence.

Step-by-step guidance.

Before you start

  • A factory with its project database provisioned.
  • For the Studio view of tables, SQL and recovery, see Work with databases.

Choose where data lives

DataStore it in
Records, ownership, relationships, searchable metadataThe factory PostgreSQL database.
Uploaded documents, images, generated filesManaged project storage, with relational metadata in PostgreSQL when needed.
Software that needs a filesystemA persistent disk. It is not a substitute for the database or file storage.
Session state in the browserNot persistence. Never store application data in localStorage.

Ordinary persisted apps use a managed backend with its own parameterized database client. Workflows use saved database queries for ETL, cron, pipelines and delegated jobs. Database credentials never go into frontend code, Git, images or logs.

Persist from a managed backend

  1. Enable `database:true` in the service’s development and production environments. The starter’s database client reads the injected connection values.
  2. Create only the tables, constraints and indexes the first route needs, with idempotent migrations.
  3. Quote the factory schema as an SQL identifier and pass every request value as a query parameter.
  4. Add owner columns only when the product has accounts, and enforce them from the verified session on every read and write. See Accounts.

Enable a PostgreSQL extension

Rumata installs allowlisted extensions such as `vector` for embeddings, `pg_trgm`, `citext` and `uuid-ossp` with platform privileges. Project roles and `rumata.executeSql` do not run `CREATE EXTENSION`, so remove it from migrations instead of retrying it.

  • Call `rumata.setDatabaseExtension` to request it; list state with `rumata.listDatabaseExtensions`. Over public MCP or HTTP use `PUT /project/hosted-database/{projectId}/extensions/{name}`. Enabling wakes the database.
  • Poll the extension list until its state is `applied` before running migrations that use it. A `failed` state carries the reason.
  • Extensions install in `public`, which every factory connection resolves, so `vector(1536)` works unqualified.

Exports, backups and recovery

Database Studio offers a downloadable compressed SQL export of the factory’s database structure and records, backup creation, and recovery to an available recovery point. See the Studio walkthrough for the steps. The recovery window depends on the plan.