Trims corps before inserting them.
[platal.git] / modules / fusionax / Formations.sql
CommitLineData
b9ad0878
PC
1-- Import complet des formations
2
3DROP TABLE IF EXISTS `fusionax_formations`;
4
5CREATE TABLE IF NOT EXISTS `fusionax_formations` (
c7eac294 6 FO CHAR(2) NOT NULL COMMENT 'Vaut toujours FO pour cette table',
e48763dc 7 ax_id VARCHAR(8) NOT NULL COMMENT 'Id unique de l''ancien',
53595c2a
SJ
8 Intitule_diplome VARCHAR(255) NOT NULL DEFAULT 0 COMMENT 'Intitulé du diplôme',
9 Intitule_formation VARCHAR(255) NOT NULL DEFAULT 0 COMMENT 'Intitulé de la formation',
10 Descr_formation VARCHAR(255) NOT NULL COMMENT 'Description de la formation',
a48b23c3 11 pid INT(11) UNSIGNED DEFAULT NULL,
325af12b
SJ
12 eduid INT(4) DEFAULT NULL,
13 degreeid INT(4) DEFAULT NULL,
14 fieldid INT(2) DEFAULT NULL,
15 PRIMARY KEY (ax_id, Intitule_diplome, Intitule_formation, Descr_formation),
53595c2a
SJ
16 INDEX (Intitule_diplome(60)),
17 INDEX (Intitule_formation(60)),
18 INDEX (Descr_formation(60)),
a48b23c3
SJ
19 INDEX (pid),
20 INDEX (eduid),
21 INDEX (degreeid),
22 INDEX (fieldid)
ddc4c642 23) ENGINE=InnoDB, CHARSET=utf8;
b9ad0878 24
53595c2a 25LOAD DATA LOCAL INFILE '{?}Formations.txt' INTO TABLE fusionax_formations CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'
e48763dc 26(FO, ax_id, Intitule_diplome, Intitule_formation, Descr_formation);
53595c2a
SJ
27
28 UPDATE fusionax_formations AS f
29INNER JOIN profile_education_enum AS e ON (f.Intitule_diplome = e.abbreviation)
30 SET f.Intitule_diplome = e.name
31 WHERE f.Intitule_diplome != '';