From 0b730031cf20ad24af8482c90a9e2495ca074852 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 19 Dec 2010 23:42:30 +0100 Subject: [PATCH] Deals with unknown corps. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- upgrade/1.0.1/merge.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/upgrade/1.0.1/merge.php b/upgrade/1.0.1/merge.php index d0b6fe5..90d320f 100755 --- a/upgrade/1.0.1/merge.php +++ b/upgrade/1.0.1/merge.php @@ -146,6 +146,13 @@ XDB::rawExecute('UPDATE profiles AS p XDB::rawExecute('ALTER TABLE geoloc_countries DROP INDEX licensePlate'); // Updates corps. +XDB::rawExecute("INSERT IGNORE INTO profile_corps_enum (name, abbreviation) + VALUES ('Ancien élève étranger', 'Z')"; +XDB::rawExecute("INSERT IGNORE INTO profile_corps_rank_enum (name, abbreviation) + VALUES ('Ing.ch.P.C.hon.', 'DEL1'), ('Ing.Mil.Air Retr.', 'DEL2'), + ('Col.hon.Tra.', 'DEL3'), ('Colonel CR', 'DEL4'), + ('Conseil d'Etat', 'DEL5'), ('Commiss.Gén. Brigade aérienne', 'DEL6'), + ('Off. Mar. dém.', 'DEL7'), ('Maître des Requêtes', 'DEL8')"); XDB::rawExecute('UPDATE profile_corps AS pc INNER JOIN fusionax_anciens AS f ON (f.pid = pc.pid) INNER JOIN profile_corps_enum AS c ON (f.corps_sortie = c.abbreviation) @@ -168,6 +175,14 @@ XDB::rawExecute("UPDATE profile_corps_enum WHERE name = 'Aucun (anc. démissionnaire)'"); XDB::rawExecute("DELETE FROM profile_corps_enum WHERE name = 'Ancien élève étranger'"); +XDB::rawExecute("UPDATE profile_corps AS c + INNER JOIN profile_corps_rank_enum AS r ON (c.rankid = r.id) + INNER JOIN profile_corps_rank_enum AS a ON (a.name = 'Aucun') + SET c.rankid = a.id + WHERE r.name LIKE 'DEL%'"); +XDB::rawExecute("DELETE FROM profile_corps_rank_enum + WHERE name LIKE 'DEL%'") + // Updates email_directory. XDB::rawExecute("UPDATE profiles AS p -- 2.1.4