# Updating Wolfden Phone

Keep your installation up to date while preserving player data.

## Before updating

Make a database backup and a copy of your current `wd_phone` folder. Make sure the copy includes:

- your edited config files, and your own override files in `config/local/` and `config/local/server/`;
- your wording overrides in `web/dist/locales/overrides/` and `locales/overrides/`;
- your map image in `maps/`, if you added one;
- the `media_uploads` folder, if you self-host media.

Test the update on a staging server before applying it to your live server.

The database update file is always `migrations/install.sql`. Do not run `migrations/uninstall.sql`: it permanently deletes phone data.

## Install the update

1. Stop Wolfden Phone (`stop wd_phone` in the server console) or shut down the server.
2. Replace the resource files with the new version. Keep `media_uploads/` if you self-host media.
3. Merge your settings into the updated config files. Avoid overwriting new config files wholesale with older ones, as you may lose new options. Copy your files back into `config/local/`, `config/local/server/` and both `overrides/` folders.
4. Import `migrations/install.sql` into the same database your server uses.
5. Add any new inventory items and copy the item images from `inventory/` again. Every item is listed in [Installation](#/docs/wd_phone/installation).
6. Keep `web/dist` together as shipped. The interface needs no build step.
7. Start the resource and check the console for the boot self-check and any errors.

```text
stop wd_phone
# Replace files and import migrations/install.sql before the next command.
ensure wd_phone
```

## Updating from 1.0.0

Version 1.0.1 renames the product, its models and some features (see the [Changelog](#/docs/wd_phone/changelog)). Item names, config keys, exports, callbacks and the database tables are the same as in 1.0.0, so items players carry, saved data and your other resources keep working. Follow the steps above, then:

1. **Re-import the item labels.** Replace your Wolfden Phone entries in `ox_inventory/data/items.lua` with those from the new `migrations/ox_inventory_items.lua`, or in `QBShared.Items` with those from `migrations/qb_inventory_items.lua`, and restart the inventory. Only the labels and descriptions changed, such as **Wolfden Phone (Ocean Blue)** for `nova_phone_ocean` and **NovaBuds · White** for `novapods_white`. The item images are unchanged.
2. **Merge, don't restore, your config files.** The shipped config files carry the new names: the model labels in `config/devices.lua`, NovaBuds and Nova Studio in `config/novapods.lua`, Locate in `config/apps.lua`, the Wolfden Kiosk store in `config/mobile_shops_server.lua` and the software version in `config/shared.lua`. Copying your 1.0.0 copies of these files back would bring the old names back. Settings you keep in `config/local/` are unaffected.
3. **Check your wording overrides.** If your files in the `overrides/` folders reword text that mentions an old name, such as Face ID or Find My, update them.
4. If you use the Browser add-on, replace `nova_browser` with the one from `nova_browser-1.0.1.zip`.

Importing `migrations/install.sql` is still part of the update. It adds no tables or columns in 1.0.1 and is safe to import again.

## Keep your changes update-proof

An update replaces the shipped files, so the fewer of them you edit, the easier updates are:

- **Settings:** put your changes in `config/local/*.lua`, which loads after the shipped shared config files. These files are sent to every player, so server-only settings and keys go in `config/local/server/*.lua` instead. The release ships both folders with only an empty placeholder file.
- **Keys and secrets:** keep them in `server.cfg` convars, such as `FIVEMANAGE_MEDIA_API_KEY`, `NOVA_TURN_SECRET` and `wd_phone:assist_key`, set with `set`, never `setr`.
- **Wording:** put only the text you change in `web/dist/locales/overrides/<code>.json` (the phone screen) and `locales/overrides/<code>.json` (server messages). They are merged over the shipped language files key by key, which an update replaces.
- **Music and Maps:** the release ships no radio stations, songs or map image. Set your stations, songs and map settings in `config/local/`, and keep a copy of your map image from `maps/`.

See [Configuration](#/docs/wd_phone/configuration) for details.

## Keep the item signing key

Phones, SIMs and accessories are signed with your server's key, kept in the database or set as `wd_phone:secret` in `server.cfg`. Keep the same key across updates and when moving to a new machine: restore the database with it, and keep the convar if you set one.

If the key ever changes, items already in use are refused until an admin signs them again with `phoneadmin signitems` while the players who carry them are online. See [Item signatures](#/docs/wd_phone/admin?section=item-signatures) for which items that reaches.

## Verify the update

Run these in the server console:

```text
phoneadmin schema
phoneadmin selftest
```

`phoneadmin schema` should answer that the schema matches `migrations/install.sql`. If it reports missing tables or columns, back up and re-import `migrations/install.sql`. The [self-test](#/docs/wd_phone/admin?section=check-your-installation) must finish with `0 failed`. It creates throwaway test phones, runs the real server code on them, then removes them; no player's data is touched. Its report also warns about missing items, language files and settings.

On your test server, check:

- Existing phones keep their settings, contacts, messages and photos.
- A new phone completes setup and can activate a SIM.
- Two players can call and message, including with the recipient's phone closed.
- Camera photos and videos upload and reopen.
- Wallet payments match the bank.
- Nova Store installs and backups work.

## Existing apps and player data

App defaults are applied when a phone first receives its installed apps. Existing phones keep their installed apps; new apps reach them through Nova Store. Changing `preinstalled` is not a command to reset every player's phone.

Do not run [`phoneadmin resetapps`](#/docs/wd_phone/admin?section=the-phoneadmin-command) on all phones as part of a normal update. It resets installed apps, permissions, notification settings and the home layout on the selected phone to a new phone's.

## If you need to roll back

Stop the resource. Restore the matching resource files and database backup together, then restart and verify. Replacing only the Lua files may leave the older code using a newer database schema.
