Project

General

Profile

Bulk renaming users/mail addresses

Added by Lib Reg over 7 years ago

Hi,

we changed domain names and I would like to bulk rename a bunch of user loginnames and E-mail addresses they use (without affecting the passwords), how can I do this?

Environment:
Redmine version 2.5.2.stable
Ruby version 1.9.3-p194 (2012-04-20) [x86_64-linux]
Rails version 3.2.19
Environment production
Database adapter PostgreSQL


Replies (5)

RE: Bulk renaming users/mail addresses - Added by Pavel Potcheptsov about 7 years ago

For email:

UPDATE email_addresses SET `address` = REPLACE(address, 'old.domain', 'new.domain') WHERE `address` LIKE '%old.domain%'

For login:
UPDATE users SET `login` = REPLACE(login, 'old.domain', 'new.domain') WHERE `login` LIKE '%old.domain%'

RE: Bulk renaming users/mail addresses - Added by Lib Reg about 7 years ago

Thankyou, I will try that!

RE: Bulk renaming users/mail addresses - Added by Lib Reg about 7 years ago

Note: in preparation I looked at the database layout and the "email_address" table should be "users" too, also the "address" column should be "mail". Lastly, AFAIK Postgresql doesn't like backticks, so will omit those.

RE: Bulk renaming users/mail addresses - Added by Pavel Potcheptsov about 7 years ago

Maybe database schema has been changed from version to version. I've just gave you idea.

RE: Bulk renaming users/mail addresses - Added by Lib Reg about 7 years ago

Thanks, it helped me on the way, I noted the current schema for others :)

    (1-5/5)