Deals with unknown corps.
authorStéphane Jacob <sj@m4x.org>
Sun, 19 Dec 2010 22:42:30 +0000 (23:42 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 20 Dec 2010 17:47:34 +0000 (18:47 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
upgrade/1.0.1/merge.php

index d0b6fe5..90d320f 100755 (executable)
@@ -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