Import singletons from auth_user_quick.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 29 Dec 2008 22:39:19 +0000 (23:39 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 29 Dec 2008 22:39:19 +0000 (23:39 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
upgrade/account/01_profiles.sql
upgrade/account/99_insertion.sql

index 5f0e555..e5f9cd1 100644 (file)
@@ -12,6 +12,10 @@ create table profiles (
   birthdate date default null,
   birthdate_ref date default null,
   deathdate date default null,
+  freetext mediumtext default null,
+  freetext_pub enum('private', 'public') not null default 'private',
+  medals_pub enum('private', 'public') not null default 'private',
+  alias_pub enum('private', 'public') not null default 'private',
 
   # Last modification date (for notifications)
   last_change date not null,
index 311e3c4..a7ecadb 100644 (file)
@@ -36,12 +36,17 @@ insert into carvas
 
 # Insert all existing profiles
 insert into profiles
-     select user_id AS pid, hruid AS hrpid, matricule AS xorg_id,
-            matricule_ax AS ax_id, naissance AS birthdate, naissance_ini AS birthdate_ref,
-            IF(deces = 0, NULL, deces) AS deathdate,
-            date AS last_change
-       from auth_user_md5
-      where hruid is not null;
+     select u.user_id AS pid, u.hruid AS hrpid, u.matricule AS xorg_id,
+            u.matricule_ax AS ax_id, u.naissance AS birthdate, u.naissance_ini AS birthdate_ref,
+            IF(u.deces = 0, NULL, u.deces) AS deathdate,
+            u.date AS last_change,
+            IF(LENGTH(q.profile_freetext) > 0, q.profile_freetext, NULL) AS freetext,
+            q.profile_freetext_pub AS freetext_pub,
+            q.profile_medals_pub AS medals_pub,
+            q.emails_alias_pub AS alias_pub
+       from auth_user_md5 AS u
+  left join auth_user_quick AS q ON (u.user_id = q.user_id)
+      where u.hruid is not null;
 
 # Add associations account <-> profile
 insert into account_profiles