From 6457ddb4c82a81f7acfe19cc0ae5f2ec799e4ec0 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 7 Dec 2008 17:55:33 +0100 Subject: [PATCH] auth_user_md5 -> accounts conversion script. Signed-off-by: Florent Bruneau --- upgrade/account/00_account.sql | 3 ++- upgrade/account/01_account_insertion.sql | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 upgrade/account/01_account_insertion.sql diff --git a/upgrade/account/00_account.sql b/upgrade/account/00_account.sql index 89c8d47..94013bb 100644 --- a/upgrade/account/00_account.sql +++ b/upgrade/account/00_account.sql @@ -17,7 +17,8 @@ CREATE TABLE accounts ( comment varchar(255) default null, # User settings - name varchar(255) default null, + full_name varchar(255) default null, + display_name varchar(255) default null, sex enum('female', 'male') not null default 'male', mail_format enum('plain', 'html') not null default 'html', skin varchar(32) default null, diff --git a/upgrade/account/01_account_insertion.sql b/upgrade/account/01_account_insertion.sql new file mode 100644 index 0000000..2673de8 --- /dev/null +++ b/upgrade/account/01_account_insertion.sql @@ -0,0 +1,26 @@ +insert into account_types + values ('x', 'mail,groups,forums,list,search,portal'); + +insert into accounts + select u.user_id AS uid, hruid AS hruid, 'x' AS type, + perms = 'admin' AS is_admin, + IF(perms = 'admin' or perms = 'user', 'active', perms) AS state, + IF(LENGTH(password) = 40, password, NULL) AS password, + date_ins AS registration_date, + IF(FIND_IN_SET('watch', flags), 'watch', '') AS flags, + IF(LENGTH(comment) > 0, comment, NULL) AS comment, + CONCAT(prenom, ' ', IF (nom_usage != '' and nom_usage IS NOT NULL, nom_usage, nom)) AS full_name, + prenom AS display_name, + IF(FIND_IN_SET('femme', flags), 'female', 'male') AS sex, + IF(q.core_mail_fmt = 'html', 'html', 'plain') AS mail_format, + q.skin AS skin + from auth_user_md5 as u + left join auth_user_quick as q on (q.user_id = u.user_id) + where hruid is not null; + +insert into account_profiles + select user_id AS uid, user_id AS pid, 'owner' AS perms + from auth_user_md5 + where hruid is not null; + +# vim:set syntax=mysql: -- 2.1.4