Databases
A > database block declares a connection. The first unnamed block is the primary database, exposed at runtime as main_db. Named blocks (> database [analytics]) get their own global, such as analytics_db. Supported providers are sqlite, postgres, and (planned) sqlserver.
SQLite (default)
settings.rat
The simplest config: one file, nothing to deploy. Set auto_migrate: true and pending migrations apply on first connection, so a fresh checkout runs with no setup.
# settings.rat
> database
provider: 'sqlite'
url: 'file:./dev.db'
auto_migrate: true Postgres
Same block, different provider
Switch providers by changing one line. The URL format is whatever Go's pgx driver accepts, including connection strings and env-var references.
> database
provider: 'postgres'
url: 'postgres://user:pw@localhost/myapp' Multiple databases
Name the secondary ones
The unnamed block is the default. Named blocks live alongside it, which lets you split operational writes from analytics or OLAP reads. The runtime exposes each as <name>_db.
# settings.rat
> database
provider: 'sqlite'
url: 'file:./main.db'
> database [analytics]
provider: 'postgres'
url: 'postgres://...'
# in code:
# main_db.user.add(...)
# analytics_db.event.add(...)