auth_user_md5 -> accounts conversion script.
[platal.git] / upgrade / account / 01_account_insertion.sql
1 insert into account_types
2 values ('x', 'mail,groups,forums,list,search,portal');
3
4 insert into accounts
5 select u.user_id AS uid, hruid AS hruid, 'x' AS type,
6 perms = 'admin' AS is_admin,
7 IF(perms = 'admin' or perms = 'user', 'active', perms) AS state,
8 IF(LENGTH(password) = 40, password, NULL) AS password,
9 date_ins AS registration_date,
10 IF(FIND_IN_SET('watch', flags), 'watch', '') AS flags,
11 IF(LENGTH(comment) > 0, comment, NULL) AS comment,
12 CONCAT(prenom, ' ', IF (nom_usage != '' and nom_usage IS NOT NULL, nom_usage, nom)) AS full_name,
13 prenom AS display_name,
14 IF(FIND_IN_SET('femme', flags), 'female', 'male') AS sex,
15 IF(q.core_mail_fmt = 'html', 'html', 'plain') AS mail_format,
16 q.skin AS skin
17 from auth_user_md5 as u
18 left join auth_user_quick as q on (q.user_id = u.user_id)
19 where hruid is not null;
20
21 insert into account_profiles
22 select user_id AS uid, user_id AS pid, 'owner' AS perms
23 from auth_user_md5
24 where hruid is not null;
25
26 # vim:set syntax=mysql: