Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Database

[database] names the connection.

[database]
url = "postgres://localhost/acme_dev"
max_connections = 10             # optional
acquire_timeout_secs = 5         # optional
KeyDescription
urlThe connection URL. Required.
max_connectionsThe pool ceiling. Default 10.
acquire_timeout_secsSeconds to wait for a pooled connection. Default 5.

Choose the driver

DatabaseURLFeature
PostgreSQLpostgres://user:pass@host/acmepostgres
MySQL / MariaDBmysql://user:pass@host/acmemysql
SQLitesqlite://storage/database.db?mode=rwcsqlite
[dependencies]
lateritecmf = { version = "0.12", features = ["postgres"] }

Keep the URL out of version control

# config/local.toml, git-ignored
[database]
url = "postgres://localhost/acme_dev"
LAT__DATABASE__URL="postgres://acme:secret@db.internal/acme" ./acme

Give lat the URL

lat admin list --database-url postgres://localhost/acme_dev
DATABASE_URL=postgres://localhost/acme_dev lat admin list
SourceOrder
--database-urlFirst.
DATABASE_URLSecond.
database.url of the application found from the current directory upwardLast.