1 #
Create a
type 'X' with all permissions
2 insert into account_types
3 values ('x', 'mail,groups,forums,list,search,portal');
5 #
Insert all existing 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,
11 IF(LENGTH(q.core_rss_hash
) > 0, q.core_rss_hash
, NULL) AS token,
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
,
18 IF(q.core_mail_fmt
= 'html', 'html', 'text') AS email_format
,
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;
24 #
Insert all existing 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
29 where hruid
is not null;
31 #
Add associations account
<-> profile
32 insert into account_profiles
33 select user_id
AS uid
, user_id
AS pid
, 'owner' AS perms
35 where hruid
is not null;
37 # vim
:set syntax
=mysql
: