Closed NeleB54Gold closed 1 year ago
If you have access to the database you can null out the deleted at column for the user to undo it.
Or, I wonder if you can create a second admin account and then use that to undo the first one.
If you have access to the database you can null out the deleted at column for the user to undo it.
Or, I wonder if you can create a second admin account and then use that to undo the first one.
How can I read the postgre database in order to change it/add a new account?
Assuming your database name is immich
and your database user is postgres
(default value from Immich)
psql -U postgres -d immich
UPDATE users
SET "deletedAt" = null
WHERE email = 'your-admin-email';
Should be good to go.
Maybe it would be good to add some checks that prevent deleting the admin account 😛.
It also might be worthwhile to add some cli commands to help with resolving some of these database related fixes, like make a user an admin, etc.
Maybe it would be good to add some checks that prevent deleting the admin account 😛.
It also might be worthwhile to add some cli commands to help with resolving some of these database related fixes, like make a user an admin, etc.
From the PR deleting user I remember I saw that check 🤔
Maybe it would be good to add some checks that prevent deleting the admin account 😛. It also might be worthwhile to add some cli commands to help with resolving some of these database related fixes, like make a user an admin, etc.
From the PR deleting user I remember I saw that check 🤔
damnit I missed it
Assuming your database name is
immich
and your database user ispostgres
(default value from Immich)
- Attach to the Postgres container
- execute
psql -U postgres -d immich
- Then execute
UPDATE users SET "deletedAt" = null WHERE email = 'your-admin-email';
Should be good to go.
I'm sorry, I'm not an expert with docker, how can I find the immich name to attach? I tried with immich, immich-app, immich_app, but maybe is an ID from the conteiner idk
You can run docker ps to get a list of running containers, or docker ps -a to include ones that are stopped.
Also, it'd probably be easier to assist/chat/help if you posted on discord, instead of using this GitHub issue.
With docker ps
you will see a list below
Then using the command below to get into the container
docker exec -it immich_postgres bash
Ok, I recovered my account, but why the other account is still there? I deleted the "salvatore"'s account, and when I clicked on it too many time (yes, I know, sometimes I'm really stupid), probably some ID changed in order to delete my account, because, how can I delete myself from my profile?
Ok, I recovered my account, but why the other account is still there? I deleted the "salvatore"'s account, and when I clicked on it too many time (yes, I know, sometimes I'm really stupid), probably some ID changed in order to delete my account, because, how can I delete myself from my profile?
So the salvator
account is a non-admin account, correct?
Ok, I recovered my account, but why the other account is still there? I deleted the "salvatore"'s account, and when I clicked on it too many time (yes, I know, sometimes I'm really stupid), probably some ID changed in order to delete my account, because, how can I delete myself from my profile?
So the
salvator
account is a non-admin account, correct?
Correct, now the schedule delete go to 3 December, it's 7 days later, maybe I need to update immich to be sure that it can be deleted that day, but it's ok, the salvatore have no media files on it, it was only an account management test for me
The delete action will trigger 7 days grace period where you can recover the account.
I wonder how did you delete the admin account in the first place. Or do you mean you were deleting the non-admin account salvatore
? Note that the admin account doesn't show up in the user management.
The delete action will trigger 7 days grace period where you can recover the account.
I wonder how did you delete the admin account in the first place. Or do you mean you were deleting the non-admin account
salvatore
? Note that the admin account doesn't show up in the user management.
As I said before, I was constantly clicking on the button to delete Salvatore's account, and I don't know how, and I scheduled the deletion to mine, because it wouldn't let me login anymore and when i updated with the request on the database i was able to login again. Oof, really, I want to help, but this time was totally random
Hmm strange, but good report, though. I will take a look at the continuation clicking on the button. I guess we can close this issue.
Hmm strange, but good report, though. I will take a look at the continuation clicking on the button. I guess we can close this issue.
Yes, thank you all for the instant help!
I think there is a bug where email is not uniquely enforced at the database level so two request (submit button clicked twice quickly) can cause two accounts with the same email to be successfully created. I know we patched the UI for this, but maybe there are two accounts with the same email and that has led to this weird situation/behavior.
Can you use SQL to list all the users? I bet there are two with the same email, one or both are admins.
I think there is a bug where email is not uniquely enforced at the database level so two request (submit button clicked twice quickly) can cause two accounts with the same email to be successfully created. I know we patched the UI for this, but maybe there are two accounts with the same email and that has led to this weird situation/behavior.
Can you use SQL to list all the users? I bet there are two with the same email, one or both are admins.
Oh, ok, I'm on my phone now, sorry for Termius quality lol
Looks normal/good, so there goes that theory!
Feature detail
i'm so stupid i requested deletion of the only admin account on immich, how can i cancel it? I stopped the docker before it can start delete everything, please HELP
Platform
Server