Thanks for your reply.
Yes, I am able to start / enter the app, I am also doing as you suggested.
discourse=# REINDEX TABLE users;
ERROR: could not create unique index "index_users_on_username_lower"
DETAIL: Key (username_lower)=(mostafa11) is duplicated.
The problem is duplicates keep coming, I have a lot of user over 300K.
Is there any way to check how many duplicates or list all of them?
For fixing, I was updating the username_lower like this: I was appending some number at the end.
UPDATE users SET username_lower = 'xxx' WHERE id = xxx;
Do I need also to update the username column to match username_lower? Is there any faster way, like automatically fixing those duplicates?
My website is now offline, so any help is highly appreciated.