Merge commit 'origin/master' into hruid
[platal.git] / upgrade / hruid / 03_hruid.sql
1 # Creates a new column for the hruid field, and adds an index on it.
2 ALTER TABLE auth_user_md5
3 ADD COLUMN hruid VARCHAR(255) DEFAULT NULL AFTER user_id,
4 ADD UNIQUE INDEX hruid(hruid);
5
6
7 # Pre-fills the hruid field with the current forlife.
8 UPDATE auth_user_md5 AS u
9 LEFT JOIN aliases AS a ON (a.id = u.user_id AND a.type = 'a_vie')
10 SET u.hruid = a.alias
11 WHERE a.alias IS NOT NULL AND u.hruid IS NULL;
12
13 # vim:set syntax=mysql: