30c9ba4a9f4dd44cc18c393a2ff12f5487553650
[platal.git] / upgrade / merge-0.0.1 / 01_emails.sql
1 INSERT INTO profile_directory (uid, email_directory)
2 SELECT user_id, Mel_usage
3 FROM fusionax_anciens AS ax
4 INNER JOIN auth_user_md5 AS u ON (ax.id_ancien = CONVERT(u.matricule_ax, BINARY))
5 WHERE Mel_publiable != '0' AND Mel_usage != '';
6
7 INSERT IGNORE INTO register_marketing (uid, email, type)
8 SELECT user_id, Mel_usage, 'ax'
9 FROM fusionax_anciens AS ax
10 INNER JOIN auth_user_md5 AS u ON (ax.id_ancien = CONVERT(u.matricule_ax, BINARY))
11 LEFT JOIN emails AS e ON (e.uid = u.user_id AND e.flags = 'active')
12 WHERE Mel_usage != '' AND
13 Mel_usage NOT LIKE '%@polytechnique.edu' AND
14 Mel_usage NOT LIKE '%@polytechnique.org' AND
15 Mel_usage NOT LIKE '%@m4x.org' AND
16 Mel_usage NOT LIKE '%@melix.%' AND
17 e.email IS NULL;
18
19 -- vim:set syntax=mysql: