> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/resources/mango-mdt/reference/updating.md).

# Updating

How to update Mango MDT safely — migrations, the version ledger, and live restarts.

## Standard update

1. **Back up your config folder** — `config/` is the only place your customisations live (plus any sounds you dropped into `web/sounds/`).
2. Replace the `mango_mdt` folder with the new version.
3. Restore your `config/` files (diff them against the new defaults for new options worth adopting).
4. Check `sql/update.sql` in the new version — see below.
5. `restart mango_mdt`.

## Database migrations

Two kinds, only one of which is your job:

* **Plugin migrations** run **automatically** on start — new plugin tables/columns just appear, tracked so they never run twice.
* **Core migrations** live in `sql/update.sql`, organised by version with comments saying who needs each block. A fresh install needs none of it (the ledger row in `mdt_migrations` records the version your install started at). When updating an existing install, apply the blocks newer than your recorded version.

Everything is written `IF NOT EXISTS` / idempotent — re-running a block you already applied is harmless.

## Live restarts

`restart mango_mdt` on a populated server is always safe: open tablets are force-closed cleanly, players reopen with `/mdt`, and nothing persistent is lost. Transient state (active dispatch call alerts, in-memory CCTV recognitions) resets by design — DB-backed records all survive.

## Version

The current resource version is in `fxmanifest.lua`. Keep the resource folder named `mango_mdt` across updates — item hooks and exports reference it by name.
