Commit | Line | Data |
---|---|---|
81ef0a18 | 1 | # Create a type 'X' with all permissions |
6457ddb4 FB |
2 | insert into account_types |
3 | values ('x', 'mail,groups,forums,list,search,portal'); | |
4 | ||
81ef0a18 | 5 | # Insert all existing accounts |
6457ddb4 FB |
6 | insert into accounts |
7 | select u.user_id AS uid, hruid AS hruid, 'x' AS type, | |
8 | perms = 'admin' AS is_admin, | |
9 | IF(perms = 'admin' or perms = 'user', 'active', perms) AS state, | |
10 | IF(LENGTH(password) = 40, password, NULL) AS password, | |
c67ba12a | 11 | IF(LENGTH(q.core_rss_hash) > 0, q.core_rss_hash, NULL) AS token, |
6457ddb4 FB |
12 | date_ins AS registration_date, |
13 | IF(FIND_IN_SET('watch', flags), 'watch', '') AS flags, | |
14 | IF(LENGTH(comment) > 0, comment, NULL) AS comment, | |
15 | CONCAT(prenom, ' ', IF (nom_usage != '' and nom_usage IS NOT NULL, nom_usage, nom)) AS full_name, | |
16 | prenom AS display_name, | |
17 | IF(FIND_IN_SET('femme', flags), 'female', 'male') AS sex, | |
0907974b | 18 | IF(q.core_mail_fmt = 'html', 'html', 'text') AS email_format, |
6457ddb4 FB |
19 | q.skin AS skin |
20 | from auth_user_md5 as u | |
21 | left join auth_user_quick as q on (q.user_id = u.user_id) | |
22 | where hruid is not null; | |
23 | ||
81ef0a18 FB |
24 | # Insert all existing profiles |
25 | insert into profiles | |
26 | select user_id AS pid, hruid AS hrpid, matricule AS xorg_id, | |
27 | matricule_ax AS ax_id, naissance AS birthdate, naissance_ini AS birthdate_ref | |
28 | from auth_user_md5 | |
29 | where hruid is not null; | |
30 | ||
31 | # Add associations account <-> profile | |
6457ddb4 FB |
32 | insert into account_profiles |
33 | select user_id AS uid, user_id AS pid, 'owner' AS perms | |
34 | from auth_user_md5 | |
35 | where hruid is not null; | |
36 | ||
37 | # vim:set syntax=mysql: |