#restored all trash items

1 messages · Page 1 of 1 (latest)

cunning cedarBOT
#

:wave: Hey @noble crystal,

Thanks for reaching out to us. Please follow the recommended actions below; this will help us be more effective in our support effort and leave more time for building Immich immich.

References

Checklist

  1. :ballot_box_with_check: I have verified I'm on the latest release(note that mobile app releases may take some time).
  2. :ballot_box_with_check: I have read applicable release notes.
  3. :ballot_box_with_check: I have reviewed the FAQs for known issues.
  4. :ballot_box_with_check: I have reviewed Github for known issues.
  5. :blue_square: I have tried accessing Immich via local ip (without a custom reverse proxy).
  6. :ballot_box_with_check: I have uploaded the relevant logs, docker compose, and .env files using the buttons below or the /upload command.
  7. :ballot_box_with_check: I have tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable

(an item can be marked as "complete" by reacting with the appropriate number)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

noble crystal
#

I extracted the backup and I have immich_2024_05_29_04_00_02.sql Not sure how to do the next steps.

half geyser
#

So just to confirm, are you trying to get back items that were trashed before today?

#

Or items that you went through and trashed today

summer pawn
#

Items that got restored from the trash

#

But should still get trashed

noble crystal
#

Hopefully I haven't trashed anything today and I have a backup from midnight.

half geyser
noble crystal
#

I want to restore my trash from yesterday.

half geyser
#

Alright cool

#

I have to go now but that backup should contain everything you need to do that

#

I'll help out later if nobody else gets round to it before then 🙂

noble crystal
#

ok thanks

#

in the meantime I can continue adding pictures?

#

it's already kinda too late anyway since I added so many stuff since this morning.

half geyser
noble crystal
#

good thanks

unreal vortex
#

It seems like you can just get a list of asset IDs from your backup and then re-trash them

noble crystal
#

what's the best way of doing that?

unreal vortex
#

Do you have any idea roughly how many assets we are talking about? Like a few hundred, thousand?

noble crystal
#

few hundreds I'd say

#

maximum a thousand but I think so

unreal vortex
#

I think the easiest is probably to load the backup into a temporary database then do something like select id from assets where deletedAt is not null

noble crystal
#

what application should I use? Ideally foss on windows which is my main system

unreal vortex
#

Do you want to just send me the backup SQL file and I can do it for you?

noble crystal
#

is it safe to do?

#

is there personal data in this db?

summer pawn
#

There is exif data in there, so potentially locations, and hashes of your images (basically very low res thumbnails)

spare granite
#

Also names of people that you've added, and the names and emails of users

summer pawn
#

True

noble crystal
#

oh

#

I'd prefer to try first I think

#

Thanks for suggesting though

unreal vortex
#

No worries. I obviously wouldn't do anything with it, but if you feel more comfortable not sharing it that is totally fine. Just a bit technical so it might take some time to figure out / walk you through it.

noble crystal
#

Yeah I'd prefer not to if I can 😛

spare granite
#

You'll need to restore that backup "as usual" but into a separate postgres (not the one you're using for Immich)

#

Then we can query it to get the trash

noble crystal
#

can I do this with pgadmin?

unreal vortex
#

Maybe?

#

How big is your sql file?

noble crystal
#

60mb

unreal vortex
#

The file is basically a long list of sql statements to run to recreate the tables. You could manually copy / paste them into pgAdmin. 60mb is a lot of text though.

#

Best to just use the command line

noble crystal
#

pgadmin isn't installed anymore

#

can I simply open the database in a windows app that would let me see the tables and that I can search with a term to list what was in the trash?

spare granite
#

It's just a text file, so you can open it and search for "trash"

#

That should find you the definition of the trash table and then a long list of assets it contains

#

But it might be a bit of a search

unreal vortex
#

"trash table" is the asset table where the asset has a deletedAt value

spare granite
#

So yeah, actually that won't really work

unreal vortex
#

I'd just copy/paste the docker compose file, and then delete everything except the database section

#

then run docker compose up, and you will have a database container you can load the data into

noble crystal
#

there's only 10 deletedAt results in vscode and I can see lot of null in the file. seems more like a binary file rather than a txt file

unreal vortex
#

the database rows won't say deletedAt.

noble crystal
#

I'm using truenas scale with kubernetes

unreal vortex
#

do you even have docker installed on windows?

noble crystal
#

nope

unreal vortex
#

Well, you need to stand up a postgres database somewhere and then run all the sql commands from your backup on the database, using psql or similar.

noble crystal
#

I was able to access my immich database on the running app

noble crystal
#

I think that'll I take your offer @unreal vortex

#

I'm running out of time right now and I must fix other things

#

Can you please don't look at it apart of the trash stuff and then delete the file after?

unreal vortex
#

Just send me a dm with a link or setting.

noble crystal
#

thanks

noble crystal
#

i sent you a pm!

unreal vortex
#

I have found 164 trashed assets

unreal vortex
#

If you run this on your database it should re-trash all the assets

noble crystal
#

how can I run this in pgadmin?

#

it's weird because I recall at least 250+ trashed assets

spare granite
#

There should be an SQL field you can just paste it into

noble crystal
#

I'll have to look this up on Monday, I must leave for a work weekend starting now!

noble crystal
#

Is this the right place?

unreal vortex
#

yup

noble crystal
#

Sorry it took so much time to get back. Life is crazy right now!

#

I can't paste the code you sent me in the SQL page, I must not be at the right place ```UPDATE
"assets"
SET
"deletedAt" = NOW()
WHERE
"id" IN (
'42952774-0f0f-4892-a843-0ddd04da643c',
'5d5ea906-c6fa-45c1-ba4d-f68dcd2edd3f',
[...]
);

#

I just found something called the query tool which seems to accept SQL commands.

#

It worked! Although not everything from my trash has been restored. There were many more stuff in there which is bugging me.

#

Could there be any other string than the deletedAt to find deleted content?

summer pawn
#

All trashed assets will/would have had the deletedAt column set

noble crystal
#

the only thing I can't think of is that I would have empty the recycle bin at some point and that I don't remember it.