# Local store

mforge keeps everything it syncs in one SQLite file. See
[Global options](commands.md) for where it lives.

## Upgrades

When a new release changes the store's schema, mforge upgrades the file
automatically the first time any command opens it. There is nothing to run.

Some upgrades rewrite or remove rows. For example, the upgrade to schema 4
merges duplicate provider entries and drops repeated copies of a repository's
synced data. The next `mf sync` downloads that data again.

## Backups

Before upgrading an existing store, mforge copies it next to the original as
`<store>.v<N>.bak`, where `N` is the schema version the store was at before
the upgrade:

```text
mforge.db
mforge.db.v3.bak
```

Only the most recent backup is kept, so an older `.v<N>.bak` is deleted once a
new one is written. Files you name yourself, such as `mforge.db.mine.bak`, are
never touched.

To roll back, replace the store with the backup and use the mforge release
that matches it:

```bash
mv mforge.db.v3.bak mforge.db
```
