# Publish an update and go back if it breaks

Publish a new version of your site, follow each step, and if something breaks put the previous version back in one click, with an optional one-off script.

You changed your code and want it live. This guide publishes the update, checks it, and shows how to go back to the version before if it breaks.

## What you need

- A site whose code comes from a code host or a `.zip` upload.
- The change pushed to the branch the site publishes (shown in **Update settings** › **Branch**), or a new `.zip`.

## Steps

1. **Turn on the after-update check (once).** Open the site's **Updates** › **After-update check**, choose a page that loads without signing in (Laravel: `/up`) and save. From now on, a version that breaks that page is switched back by itself.

   ![The After-update check page](https://internal.fuzops.com/docs-img/site-after-update-check.webp)

2. **Publish.** Choose **Publish update** on the site (or in the bar at the bottom of any of its pages). For an uploaded site, choose **Upload a new version** and pick the `.zip`.

3. **Follow the steps.** The update page opens. Each step shows its result and time. Visitors keep seeing the current version until **Your site switches to the new version here**.

   ![An update page with each step done](https://internal.fuzops.com/docs-img/update-published.webp)

4. **Check the site.** When the page says **Published**, open your site and check what you changed.

5. **If it broke, go back.** On the site's overview, the **Live now** line has **Go back to the previous version** (the update page has it too); choose it and confirm. The site switches back straight away; nothing is deleted. To go back further, open the page of an older update, or its row in the **Updates** tab, and choose **Use this version**.

   ![The Updates tab with earlier versions you can go back to](https://internal.fuzops.com/docs-img/site-updates.webp)

6. **Undo a database change if needed.** If the new version changed the database in a way the old one cannot use, open **Run a one-off script after going back** in the confirmation and enter the command that undoes it (for example a migration rollback). It runs once in the earlier version, right after the switch.

7. **Fix and publish again.** Fix the problem in your code and publish a new update.

## What you should see

The **Updates** tab lists your update as **Published** and marks the version that is **Live now**. After going back, a new row says "Went back to an earlier version" with who did it.

## If it goes wrong

- **The update failed**: the page says what happened and that your visitors were kept on the version that worked, where it stopped, and **What to do**. **Send this to my developer** copies a link and a short summary to send on. Fix the cause and choose **Publish again** in the bar at the bottom.
- **The version you want is not listed**: only the versions the server keeps can be put back. Raise **Number of versions to keep** in **Update settings** for next time.
- **The update is stuck on "Waiting to start"**: the server may not be responding. Check the server's status on Home. You can **Cancel update**; visitors keep the version they see now.
