# Generic single-database configuration.

Alembic via Flask-Migrate. Fast path: `ALEMBIC_STANDALONE=1` + `alembic upgrade` only
(skips Flask app load). All other commands use the full app.

## Fast-path upgrade

```bash
ALEMBIC_STANDALONE=1 alembic -c migrations/alembic.ini upgrade head
```

Production: same, with `-c @inst_dir@/migrations/alembic.ini`. Env var: `1`, `true`, or `yes`.

Config load order (same as Flask app): `backend/config.py` → `~/etc/backend.cfg`
(`UI_BACKEND_CONFIG`) → `~/etc/backend.local.cfg` (`UI_BACKEND_LOCAL_CONFIG`). Later
files win; missing overrides are ignored. `backend/config.py` is resolved via
`find_spec('backend')` on `sys.path`, or `../backend/` in a dev checkout.

`script_location = %(here)s` in `alembic.ini` — scripts are found relative to the ini file.

## New migrations

Autogenerate (needs Flask app + metadata):

```bash
python3 manage.py db migrate -m "short description"
```

Empty revision:

```bash
alembic -c migrations/alembic.ini revision -m "short description"
```

Edit files under `migrations/versions/`.
