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, |
0511895d | 12 | IF(LENGTH(smtppass) = 0, NULL, smtppass) AS weak_password, |
6457ddb4 FB |
13 | date_ins AS registration_date, |
14 | IF(FIND_IN_SET('watch', flags), 'watch', '') AS flags, | |
15 | IF(LENGTH(comment) > 0, comment, NULL) AS comment, | |
16 | CONCAT(prenom, ' ', IF (nom_usage != '' and nom_usage IS NOT NULL, nom_usage, nom)) AS full_name, | |
17 | prenom AS display_name, | |
18 | IF(FIND_IN_SET('femme', flags), 'female', 'male') AS sex, | |
0907974b | 19 | IF(q.core_mail_fmt = 'html', 'html', 'text') AS email_format, |
0511895d FB |
20 | q.skin AS skin, |
21 | q.last_version AS last_version | |
6457ddb4 FB |
22 | from auth_user_md5 as u |
23 | left join auth_user_quick as q on (q.user_id = u.user_id) | |
24 | where hruid is not null; | |
25 | ||
0511895d FB |
26 | # Insert carnet-relative data |
27 | insert into watch | |
28 | select user_id as uid, watch_flags as flags, watch_last as last | |
29 | from auth_user_quick; | |
30 | ||
c1e98576 FB |
31 | # Insert carvas |
32 | insert into carvas | |
33 | select user_id, redirecturl | |
34 | from auth_user_quick | |
35 | where LENGTH(redirecturl) > 0; | |
36 | ||
81ef0a18 FB |
37 | # Insert all existing profiles |
38 | insert into profiles | |
39 | select user_id AS pid, hruid AS hrpid, matricule AS xorg_id, | |
cde4fb1d FB |
40 | matricule_ax AS ax_id, naissance AS birthdate, naissance_ini AS birthdate_ref, |
41 | IF(deces = 0, NULL, deces) AS deathdate | |
81ef0a18 FB |
42 | from auth_user_md5 |
43 | where hruid is not null; | |
44 | ||
45 | # Add associations account <-> profile | |
6457ddb4 FB |
46 | insert into account_profiles |
47 | select user_id AS uid, user_id AS pid, 'owner' AS perms | |
48 | from auth_user_md5 | |
49 | where hruid is not null; | |
50 | ||
7d15f750 FB |
51 | # Update banana last_seen timetamp |
52 | update forum_profiles as fp | |
53 | inner join auth_user_quick as q ON (q.user_id = fp.uid) | |
54 | set fp.uid = fp.uid, fp.tree_unread = fp.tree_unread, fp.tree_read = fp.tree_read, | |
55 | fp.last_seen = q.banana_last; | |
56 | ||
57 | insert ignore into forum_profiles (uid, last_seen) | |
58 | select user_id as uid, banana_last as last_seen | |
59 | from auth_user_quick | |
60 | where banana_last >= DATE_SUB(NOW(), INTERVAL 6 MONTH); | |
61 | ||
58a4e6bb FB |
62 | # Mail storage has been moved out of account settings |
63 | insert into email_options | |
64 | select user_id as uid, mail_storage as storage | |
65 | from auth_user_md5; | |
66 | ||
6457ddb4 | 67 | # vim:set syntax=mysql: |