X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=upgrade%2Fnewdirectory-0.0.1%2F10_promotion.sql;h=7dec54d9461c9a9d32037f89340a56838d70d62a;hb=304cdf32d7c38afbd381909545021fc44c8a0e05;hp=fb3b7b5ff1dcf9c2ac7f3eff8cadd6f1ad6e1446;hpb=2504be33ed7e7436c428f188bdafa9e72248131d;p=platal.git diff --git a/upgrade/newdirectory-0.0.1/10_promotion.sql b/upgrade/newdirectory-0.0.1/10_promotion.sql index fb3b7b5..7dec54d 100644 --- a/upgrade/newdirectory-0.0.1/10_promotion.sql +++ b/upgrade/newdirectory-0.0.1/10_promotion.sql @@ -1,16 +1,12 @@ -INSERT INTO profile_education (id, uid, grad_year, entry_year, eduid, degreeid, flags) - SELECT 100, user_id, promo_sortie, promo, 20, 2, 'primary' - FROM auth_user_md5; +INSERT INTO profile_education (id, pid, grad_year, entry_year, eduid, degreeid, flags) + SELECT 100, u.user_id, u.promo_sortie, u.promo, e.id, d.id, 'primary' + FROM #x4dat#.auth_user_md5 AS u + LEFT JOIN profile_education_enum AS e ON (e.abbreviation = "X") + LEFT JOIN profile_education_degree_enum AS d ON (d.degree = "Ingénieur"); -CREATE TABLE profile_display ( - uid INT(11) NOT NULL DEFAULT 0, - promo_display VARCHAR(255) DEFAULT '' NOT NULL, - PRIMARY KEY(uid) -) CHARSET=utf8; - -INSERT IGNORE INTO profile_display (uid, promo_display) - SELECT uid, CONCAT("X", entry_year) - FROM profile_education - WHERE FIND_IN_SET('primary', flags); + UPDATE profile_display AS d +INNER JOIN profile_education AS e ON (d.pid = e.pid) + SET d.promo = CONCAT("X", entry_year) + WHERE FIND_IN_SET('primary', e.flags); -- vim:set syntax=mysql: