Skip to content

Commit

Permalink
doc: how move assets,albums,persons from one account to another (immi…
Browse files Browse the repository at this point in the history
…ch-app#3652)

* Update FAQ.md

Added an item to document what can be done to move photos, albums and persons from one account to another,

* Update FAQ.md

typo in the numbering

* Update FAQ.md

add an 'advanced operation' warning

* Update FAQ.md

Typos

* chore: format

* chore: cleanup syntax codeblock

---------

Co-authored-by: Jason Rasmussen <[email protected]>
  • Loading branch information
bmaster001 and jrasm91 authored Aug 14, 2023
1 parent c81bb2b commit f55c80e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,29 @@ After removing the containers and volumes, the **Files** can be cleaned up (if n
### Why iOS app shows duplicate photos on the timeline while the web doesn't?

If you are using `My Photo Stream`, the Photos app temporarily creates duplicates of photos taken in the last 30 days. These photos are included in the `Recents` album and thus shown up twice. To fix this, you can disable `My Photo Stream` in the native Photos app or choose a different album in the backup screen in Immich.

### How can I move all data (photos, persons, albums) from one user to another?

This requires some database queries. You can do this on the command line (in the PostgreSQL container using the psql command), or you can add for example an [Adminer](https://www.adminer.org/) container to the `docker-compose.yml` file, so that you can use a web-interface.

:::warning
This is an advanced operation. If you can't to do it with the steps described here, this is not for you.
:::

1. **MAKE A BACKUP** - See [backup and restore](/docs/administration/backup-and-restore.md).
2. Find the id of both the 'source' and the 'destination' user (it's the id column in the users table)
3. Three tables need to be updated:

```sql
// reassign albums
update albums set "ownerId" = '<destinationId>' where "ownerId" = '<sourceId>';

// reassign people
update person set "ownerId" = '<destinationId>' where "ownerId" = '<sourceId>';

// reassign assets
update assets set "ownerId" = '<destinationId>' where "ownerId" = '<sourceId>'
and checksum not in (select checksum from assets where "ownerId" = '<destinationId>');
```

4. There might be left-over assets in the 'source' user's library if they are skipped by the last query because of duplicate checksums. These are probably duplicates anyway, and can probably be removed.

0 comments on commit f55c80e

Please sign in to comment.