> ## Documentation Index
> Fetch the complete documentation index at: https://formbricks.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 2.0: Upgrade guide

> Version-specific changes and preserved upgrade instructions.

> [!NOTE]
>
> Historical upgrade notes. Check the [maintenance policy](https://formbricks.com/docs/self-hosting/advanced/release-maintenance-policy.md)
> for support status. These instructions describe this release, not the current installation defaults.

Read the notes for every version you cross. Use the [upgrade checklist](https://formbricks.com/docs/self-hosting/advanced/upgrade.md)
to plan backups, service interruption and recovery. Old commands using `latest` or `stable` must be
resolved to the historical target release before use; they must not jump to today's release.

Before the Docker commands below, edit the `formbricks` service's `image` in your existing
`docker-compose.yml`. Replace `latest` with your exact published **2.0.x** tag, for example
`ghcr.io/formbricks/formbricks:v2.0.0` for the initial release. These historical GHCR tags include `v`. Confirm the selected tag with
`docker compose config --images` before running `pull` or `up`; keep your existing volumes and settings.

Formbricks v2.0 introduces significant features such as **Multi-Language Surveys** and **Advanced Styling for Surveys**, aimed at improving the flexibility and appearance of your surveys. Additionally, the release includes several optimisations, bug fixes, and smaller improvements to ensure a smoother user experience.

If you are upgrading to Formbricks v2.0, follow this guide to ensure a smooth migration of your existing Formbricks instance without encountering issues or build errors.

> [!NOTE]
>
> This upgrade requires a **data migration**. Please make sure to back up your database before proceeding.
> Follow the steps below to upgrade your Formbricks instance to v2.0.

> [!NOTE]
>
> If you've used the Formbricks Enterprise Edition with a free beta license key, your instance will be
> downgraded to the Community Edition 2.0. You can find all license details on the [license
> page](https://formbricks.com/docs/self-hosting/advanced/license.md).

> [!WARNING]
>
> We are moving from DockerHub to GitHub Packages for our images. If you are still pulling the images from
> DockerHub please change `image: formbricks/formbricks:2.0.0` to `image: ghcr.io/formbricks/formbricks:v2.0.0` in
> your `docker-compose.yml` file.

### Steps to migrate

This guide is for users who are self-hosting Formbricks using our one-click setup. If you are using a different setup, you might adjust the commands accordingly.

To run all these steps, please navigate to the `formbricks` folder where your `docker-compose.yml` file is located.

1. **Backup your Database**: This is an essential step. Please ensure that you back up your database before proceeding with the upgrade. You can use the following command to back it up:

```bash theme={null}
docker exec formbricks-postgres-1 pg_dump -Fc -U postgres -d formbricks > formbricks_pre_v2.0_$(date +%Y%m%d_%H%M%S).dump
```

> [!NOTE]
>
> If you run into “No such container”, use `docker ps` to find your container name,
> e.g. `formbricks_postgres_1`.

If you prefer storing the backup as an `*.sql` file remove the `-Fc` (custom format) option. In case of a restore scenario you will need to use `psql` then with an empty `formbricks` database.

* Pull the selected version of Formbricks:

```bash theme={null}
docker compose pull
```

* Stop the running Formbricks instance & remove the related containers:

```bash theme={null}
docker compose down
```

* Restarting the containers with the selected version of Formbricks:

```bash theme={null}
docker compose up -d
```

* Now let's migrate the data to the latest schema:

> [!NOTE]
>
> To find your Docker Network name for your Postgres Database, find it using `docker network ls`

```bash theme={null}
docker pull ghcr.io/formbricks/data-migrations:v2.0.3 && \
docker run --rm \
  --network=formbricks_default \
  -e DATABASE_URL="postgresql://postgres:postgres@postgres:5432/formbricks?schema=public" \
  -e UPGRADE_TO_VERSION="v2.0" \
  ghcr.io/formbricks/data-migrations:v2.0.3
```

The above command will migrate your data to the latest schema. This is a crucial step to migrate your existing data to the new structure. Only if the script runs successful, changes are made to the database. The script can safely run multiple times.

* That's it! Once the migration is complete, you can **now access your Formbricks instance** at the same URL as before.

### App surveys with @formbricks/js

With this upgrade, we now dynamically fetch the package from our API endpoint and have updated the package entry points to support both app and website surveys. This ensures that you always have the latest version of the package (v2.0.0+).

**Old approach:** (v1.6.5)

```ts theme={null}
import formbricks from "@formbricks/js";

formbricks.init({
  environmentId: "<environment-id>",
  apiHost: "<api-host>",
  userId: "<user-id>", // optional
});
```

**New approach:** (v2.0.0)

Website surveys:

```ts theme={null}
import formbricks from "@formbricks/js/website";

formbricks.init({
  environmentId: "<environment-id>",
  apiHost: "<api-host>",
  // userId is not supported here
});
```

App surveys:

```ts theme={null}
import formbricks from "@formbricks/js/app";

formbricks.init({
  environmentId: "<environment-id>",
  apiHost: "<api-host>",
  userId: "<user-id>", // required
});
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.