···217217| `barazo_app` | DML (SELECT, INSERT, UPDATE, DELETE) | API server |
218218| `barazo_readonly` | SELECT only | Search, public endpoints, reporting |
219219220220-The API server connects with `barazo_app` -- it cannot modify the schema. During alpha, schema is applied via `drizzle-kit push` at deploy time. In beta, `barazo_migrator` will run proper migrations.
220220+The API server connects with the database user configured in `DATABASE_URL`. On startup, it runs pending Drizzle migrations using a dedicated single-connection client, then opens the main connection pool. In a future hardening phase, migration will use a separate `barazo_migrator` role with DDL privileges, while `barazo_app` will be restricted to DML only.
221221222222### Connection Security
223223
+4-2
docs/upgrading.md
···1818./scripts/smoke-test.sh https://your-domain.com
1919```
20202121-The database schema is applied via `drizzle-kit push` during deployment. No manual schema step is needed.
2121+Database migrations are applied automatically when the API container starts. The Drizzle migration runner checks for pending migrations and applies them before accepting requests. No manual schema step is needed.
2222+2323+**Important:** Database migrations are forward-only. If you need to rollback, restore from the pre-upgrade backup.
22242325## Pinned Version Upgrade
2426···75777678Common breaking changes to watch for:
7779- **Environment variable renames** -- update your `.env` file
7878-- **Database schema changes** -- schema is pushed on deploy, but rollback may require the backup
8080+- **Database schema changes** -- migrations run automatically on startup, but rollback requires restoring from the pre-upgrade backup
7981- **Caddy configuration changes** -- check if Caddyfile needs updates