> ## 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.

# 1.6: 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.

Formbricks v1.6 introduces key features like Advanced Targeting, Segmentation, on-the-fly survey triggers, and stability improvements. This update also changes some environment variables. Follow this guide to upgrade your Formbricks instance to v1.6 smoothly.

> [!NOTE]
>
> This upgrade requires a data migration. Ensure you back up your database before proceeding. Follow the steps
> below to upgrade your Formbricks instance to v1.6.

### Steps to migrate

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

Navigate to the Formbricks folder containing your `docker-compose.yml` file to run the steps.

* **Backup your Database**: This is a crucial step. Please make sure to backup your database before proceeding with the upgrade. You can use the following command to backup your database:

```bash theme={null}
docker exec formbricks-quickstart-postgres-1 pg_dump -Fc -U postgres -d formbricks > formbricks_pre_v1.6_$(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`.

> [!NOTE]
>
> If you prefer storing the backup as a `*.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.

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

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

* Restarting the containers will automatically pull the latest 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 run --rm \
  --network=formbricks_default \
  -e DATABASE_URL="postgresql://postgres:postgres@postgres:5432/formbricks?schema=public" \
  -e UPGRADE_TO_VERSION="v1.6" \
  ghcr.io/formbricks/data-migrations:v1.6.1

```

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.

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

#### Restoring the database after a failed upgrade

```bash theme={null}
docker exec -i formbricks-quickstart-postgres-1 pg_restore --clean -U postgres -v -d formbricks < formbricks_pre_v1.6_<timestamp_of_your_dump_file>.dump
```

> [!NOTE]
>
> Replace the path to `formbricks_pre_v1.6_<timestamp_of_your_dump_file>.dump` with the exact path to your `.dump` file.

> [!NOTE]
>
> This will wipe the database and restore from the `.dump` file.

### App surveys with `@formbricks/js`

If you're using the `@formbricks/js` package, update it to version \~1.6.5 to access the latest features and improvements.

> [!NOTE]
>
> Currently, the package needs to be pinned to `~1.6.5`, see [this
> issue](https://github.com/formbricks/formbricks/issues/2273).

### Upgrade and pin the client package

```bash theme={null}
npm install @formbricks/js@~1.6.5
```

### Deprecated environment variables

| Environment Variable | Comments |
| - | - |
| `GITHUB_AUTH_ENABLED` | Was used to enable GitHub OAuth, but from v1.6, you can just set the `GITHUB_ID` and `GITHUB_SECRET` environment variables. |
| `GOOGLE_AUTH_ENABLED` | Was used to enable Google OAuth, but from v1.6, you can just set the `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` environment variables. |
| `AZUREAD_AUTH_ENABLED` | Was used to enable AzureAD OAuth, but from v1.6, you can just set the `AZUREAD_CLIENT_ID`, `AZUREAD_CLIENT_SECRET` & `AZUREAD_TENANT_ID` environment variables. |


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