# New versions

> Updating the sheet in the room without losing the players' data: the version, what must not change and how to migrate a renamed field.

Page: https://docs.rpgdesk.com/en/fichas/versoes/

## Publish a new version

1. Change the sheet and bump the manifest’s `version`: `1.0.0` → `1.0.1` for a fix, `1.1.0` for something new, `2.0.0` for a big change.
2. In **Room settings → Plugins**, install the file again. The dialog shows **Update**: “Updates the installed version 1.0.0 to 1.0.1. Sheets keep their data.”
3. Whoever has the sheet open starts seeing the new version.

If the version is lower than the installed one, the dialog warns you first (sometimes that is exactly it: going back to a version that worked).

## What must not change

- **The plugin’s `id`:** with another `id`, it is another plugin.
- **The `type` of each sheet and table:** the room’s sheets are of a type. If the type changes, the old sheets are left without a plugin (“No plugin in this room edits sheets of type…”) until the old type comes back.

Each type belongs to a single plugin in the room: a second plugin cannot bring a type that already belongs to another.

## The data

The data lives in each sheet’s document, under the fields’ names. The new version finds everything the previous one saved under the same names.

- **A new field** starts empty.
- **A field you removed from the page** is still kept, it just does not show up.
- **A renamed field** starts empty, and the data stays under the old name. To bring the data to the new name, do a small migration in JavaScript:

```js
RPGDesk.connect().then(({ doc, me, item }) => {
  // from "hit_points" (version 1.0) to "hp.current" (version 1.1); only one person migrates:
  // the sheet's owner, or a game master, if the sheet has no owner
  const migrates = me.isOwner || (!item.ownerId && me.role === 'gm');
  const old = doc.get('hit_points');
  if (migrates && old !== undefined && doc.canWrite('hp.current')) {
    doc.update({ 'hp.current': old, hit_points: null });
  }
});
```

> **Tip**
>
> Only one person migrates: that way the game master and the player, with the sheet open at the same time, do not write twice. It is the same care the RPG Desk Basic Sheet takes when it creates a new sheet’s attributes.

## Remove the plugin

Removing a plugin does not delete the sheets: they stay in the library, read-only, until the plugin is installed again. Its tables are disabled, with their data kept.
