# Upgrading to v7

import { Tabs, TabItem, Steps } from '@astrojs/starlight/components'

Upgrading an existing install to v7 is one-way. This page covers what the upgrade changes, where the backup of your database is, how to go back to an older version and return to v7, and how to try v7 without touching your current install.

:::caution[Before replacing a Docker container]
An older ROCm Compose service with a custom `INVOKEAI_ROOT` may have stored your database and files in the container's writable layer, outside its volume. Before running `docker compose up`, `docker compose down` or `./run.sh`, check the root in the old container's startup log against its mounts. Compose can remove or recreate the only container holding that data. If the root is outside the mounts, [recover it before replacing the container](/configuration/docker/#recover-data-before-replacing-a-container).
:::

## Before upgrading a single-user installation

InvokeAI now requires sign-in by default, including on localhost. If you previously worked without an account, let running jobs finish before switching modes. The administrator you create on **Set up Invoke** receives your earlier projects, boards and images, wildcards, prompt templates, fonts and workflows. To switch back to single-user mode later, first [return the work](/configuration/multi-user-mode/admin-guide/#return-work-to-single-user-mode) with `invoke-usermod --email <your email> --return-to-single-user`. Create that account while only you can reach the server: until it exists, anyone who can reach the server sees **Set up Invoke** and can claim the account, and your earlier work with it. With `host: 0.0.0.0` in `invokeai.yaml`, that includes everyone on your network, so set it to `127.0.0.1` first. The [single-user upgrade instructions](/configuration/multi-user-mode/admin-guide/#upgrading-from-single-user-mode) cover private setup and [what is transferred](/configuration/multi-user-mode/admin-guide/#earlier-work-from-single-user-mode). On an installation that already has an administrator, if your earlier work is missing, sign in as an administrator and select **Transfer to me** on the **Users** page, as [these steps](/configuration/multi-user-mode/admin-guide/#if-you-have-already-upgraded) describe.

## Docker Compose network access

After you update the Compose files, other devices can no longer connect to Invoke. To share it again, see [Run the Container](/configuration/docker/#run-the-container).

## The upgrade is one-way

The first time v7 starts on an existing install, it updates the database at `<root>/databases/invokeai.db` in place. After that, older versions cannot use it:

- v6.14 and later, and earlier v7 builds, stop at startup with an error that begins `Database contains unknown applied migration IDs`.
- v6.13 and earlier do not recognize the update. They start, log `Database update needed`, write a backup, and log `Database updated successfully`, though they changed nothing. They then run on a database they were not written for, where they can misbehave or damage it. They do this on every start, and each of these backups holds the v7 database, not a v6 one.

Restore a backup before you run any older version on this install.

The update changes the database only. Your images in `outputs/` and your models are left as they are.

## Backups

Before every update of the database, Invoke copies it to a backup in the same folder, `<root>/databases/`:

```text
invokeai_backup_<YYYYMMDD>-<HHMMSS>.db
```

When two backups are made in the same second, the later one gets a number, e.g. `invokeai_backup_20261019-093000-1.db`. Before the update, the startup log shows a warning that names the backup:

```text
Updating the database at <root>/databases/invokeai.db. Older versions of InvokeAI cannot use it after this update. Its current state is backed up to <root>/databases/invokeai_backup_20261019-093000.db; ...
```

Invoke never deletes backups. Delete old ones yourself once you no longer need them.

### Which backup to restore

To go back to v6, restore the backup written when you **first started v7**. It holds your database as v6 left it. Its name carries the date and time of that first start, in your computer's local time, and the names sort by time: it is the first backup at or after that start.

- **Not an older backup.** v6 writes backups with the same name when it updates the database itself, so older files are earlier v6 states, without your work since then.
- **Not a newer backup.** Each holds a database v6 cannot use: v7 writes one each time it updates the database, and v6.13 and earlier write one each time they start on it, as described above. If you already started an older version on the v7 database, the newest backup is one of these.

The log of that first v7 start names the file in the line `Backing up database to <root>/databases/invokeai_backup_<YYYYMMDD>-<HHMMSS>.db`. v7.0.0-alpha.1 to alpha.3 log only that line; later versions also name it in the warning shown above. Without that log, go by the time of the first start.

Nothing you did in v7 after that start is in the backup. Images you generated in v7 stay in `outputs/`, but v6's gallery does not show them. Models you installed in v7 stay in the models folder, but v6's model list does not have them.

:::caution[Models installed in v7]
v6 lists the models you installed in v7 as orphaned, and its **Sync Models** in the Model Manager offers to delete them. Keep them if you may go back to v7: the v7 database you set aside, `invokeai.db.v7`, still uses them.
:::

v7 adds `multiuser: true` to an `invokeai.yaml` that has no `multiuser` line, and v6.13 and later read it. So if you worked without an account before, they now ask you to sign in or create an administrator too. To work without accounts there, set `multiuser: false` and keep the server [local only](/configuration/multi-user-mode/admin-guide/#single-user-mode). v6.12 and earlier refuse to start with that file: copy `invokeai.yaml.bak`, which v7 saved next to it at its first start, to `invokeai.yaml`.

### MySQL and MariaDB

Invoke makes no backup of a server database. Back it up yourself before upgrading, as [MySQL and MariaDB](/configuration/external-database/) describes. To go back, restore that backup and follow the same private startup and sign-in checks described below.

## Restore a backup

<Steps>

1. Stop Invoke.

2. Open the `databases` folder in your root directory.

3. Move the current database aside: rename `invokeai.db` to `invokeai.db.v7`.

4. **Required:** if `invokeai.db-wal` or `invokeai.db-shm` exist, rename them to `invokeai.db.v7-wal` and `invokeai.db.v7-shm`. Left in place, the v7 database's write-ahead log would be applied to the restored file and could corrupt it. Renamed this way, the three files stay a complete copy of your v7 database.

5. Copy the backup you chose to `invokeai.db`. Copy it rather than rename it, so the backup stays as it is.

6. [Start the older release privately and verify the restored database](#first-start-after-switching-databases).

</Steps>

Steps 3 to 5 as commands, with your root directory and the backup's name filled in:

<Tabs syncKey="operatingSystem">
  <TabItem label="Windows" icon="seti:windows">
    ```ps
    cd <root>\databases
    Rename-Item invokeai.db invokeai.db.v7
    if (Test-Path invokeai.db-wal) { Rename-Item invokeai.db-wal invokeai.db.v7-wal }
    if (Test-Path invokeai.db-shm) { Rename-Item invokeai.db-shm invokeai.db.v7-shm }
    Copy-Item invokeai_backup_<YYYYMMDD>-<HHMMSS>.db invokeai.db
    ```
  </TabItem>
  <TabItem label="Linux/MacOS" icon="linux">
    ```bash
    cd <root>/databases
    mv invokeai.db invokeai.db.v7
    if [ -e invokeai.db-wal ]; then mv invokeai.db-wal invokeai.db.v7-wal; fi
    if [ -e invokeai.db-shm ]; then mv invokeai.db-shm invokeai.db.v7-shm; fi
    cp invokeai_backup_<YYYYMMDD>-<HHMMSS>.db invokeai.db
    ```
  </TabItem>
</Tabs>

Starting v7 on the restored database updates it again, as your first v7 start did: v7 writes another backup and logs the warning. The updated database has none of your earlier v7 work; that is in `invokeai.db.v7`. To continue with it, switch back to it instead.

## Switch back to the v7 database

To return to v7 after restoring a backup, put the v7 database you set aside back in place. What you did in v6 since the restore is not in it. Models you installed in v6 since then are missing from v7's model list, and v7 lists them as orphaned.

<Steps>

1. Stop Invoke.

2. Open the `databases` folder in your root directory.

3. Move the restored database aside: rename `invokeai.db` to `invokeai.db.v6`, and, if they exist, `invokeai.db-wal` and `invokeai.db-shm` to `invokeai.db.v6-wal` and `invokeai.db.v6-shm`.

4. Rename `invokeai.db.v7` to `invokeai.db`.

5. **Required:** if `invokeai.db.v7-wal` or `invokeai.db.v7-shm` exist, rename them to `invokeai.db-wal` and `invokeai.db-shm`. The write-ahead log can hold changes not yet written to the database file, and SQLite finds it only under the database's name.

6. [Start v7 privately and verify the restored database](#first-start-after-switching-databases). An administrator you created while using the v6 database exists only in that database. The v7 database may still need its first administrator.

</Steps>

Steps 3 to 5 as commands:

<Tabs syncKey="operatingSystem">
  <TabItem label="Windows" icon="seti:windows">
    ```ps
    cd <root>\databases
    Rename-Item invokeai.db invokeai.db.v6
    if (Test-Path invokeai.db-wal) { Rename-Item invokeai.db-wal invokeai.db.v6-wal }
    if (Test-Path invokeai.db-shm) { Rename-Item invokeai.db-shm invokeai.db.v6-shm }
    Rename-Item invokeai.db.v7 invokeai.db
    if (Test-Path invokeai.db.v7-wal) { Rename-Item invokeai.db.v7-wal invokeai.db-wal }
    if (Test-Path invokeai.db.v7-shm) { Rename-Item invokeai.db.v7-shm invokeai.db-shm }
    ```
  </TabItem>
  <TabItem label="Linux/MacOS" icon="linux">
    ```bash
    cd <root>/databases
    mv invokeai.db invokeai.db.v6
    if [ -e invokeai.db-wal ]; then mv invokeai.db-wal invokeai.db.v6-wal; fi
    if [ -e invokeai.db-shm ]; then mv invokeai.db-shm invokeai.db.v6-shm; fi
    mv invokeai.db.v7 invokeai.db
    if [ -e invokeai.db.v7-wal ]; then mv invokeai.db.v7-wal invokeai.db-wal; fi
    if [ -e invokeai.db.v7-shm ]; then mv invokeai.db.v7-shm invokeai.db-shm; fi
    ```
  </TabItem>
</Tabs>

### First start after switching databases

Use these steps in either direction. Each database has its own accounts and setup state.

1. Before starting InvokeAI, disconnect external reverse proxy routes, tunnels and port forwards. Configure the server or Docker host to [listen only on loopback](/configuration/multi-user-mode/admin-guide/#verify-local-only-access). On releases that support accounts, check that `invokeai.yaml` contains `multiuser: true` and remove any `INVOKEAI_MULTIUSER=false` environment override, or set `INVOKEAI_MULTIUSER=true` in the server environment. Without that line, v6.12 to v7.0.0-beta.2 start without sign-in. The current version adds the line to the end of the file when it starts. If it cannot, for example because the file is read-only, it logs a warning instead, so check that the line is there.
2. Start the intended release and verify local-only access. Check that the database path in the startup log matches the file you restored, or the configured server database for MySQL or MariaDB. For Docker, also check that the data mount points to the restored data.
3. For releases with accounts, open InvokeAI in a fresh browser session and confirm it requires sign-in. Sign in with an administrator from the active database, or complete first-administrator setup privately if that database predates setup. If setup appears when you expected an existing account, recheck the database and Docker mount. Restore network access only after verifying administrator sign-in and the expected data. For older releases without accounts, keep the server private or require authentication at a reverse proxy and allow remote access only through that proxy.

## Run v7 alongside v6

Give v7 its own root directory **and database** before its first start. To use SQLite in the new root, unset any inherited `INVOKEAI_DB_URL`, remove `db_url` from the v7 configuration and check that `db_dir` resolves inside the new root. For MySQL or MariaDB, point v7 at a separate, empty database. Check that any absolute storage paths or environment overrides for v7 point to its own files, including outputs and models.

- **Launcher:** install v7 into a new, empty folder. Do not select your existing install: that upgrades it in place. The folder you install into is v7's root directory.
- **Manual install:** install v7 into a new directory, as [Manual Installation](/start-here/manual/) describes, and start it with `--root` set to that directory, or set the `INVOKEAI_ROOT` environment variable. `--root` takes precedence over `INVOKEAI_ROOT`, which takes precedence over the directory of the active virtual environment; see [InvokeAI Root Directory](/configuration/invokeai-yaml/#invokeai-root-directory).

:::caution[Keep the models folders apart]
Do not point both installs' `models_dir` at the same folder. Each install knows only the models it installed itself, so **Clean up orphaned models** in one install's Model Manager lists the other install's models as orphaned and offers to delete them.
:::

[Start v7 privately and set up its first administrator](/configuration/multi-user-mode/admin-guide/#set-up-multi-user-mode). Check the startup log for v7's root and database, then confirm administrator sign-in and the new, empty gallery before enabling network access.