From: João Pedro Athayde Marcondes de André (JP) Date: Sun, 24 Oct 2010 19:45:55 +0000 (+0200) Subject: Distinguish the postfix hruid fields from the site hruid fields X-Git-Tag: xorg/1.1.0~300 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=5e8e540dfaa6900dda20d92d246a5e41a5d8408d;p=platal.git Distinguish the postfix hruid fields from the site hruid fields --- diff --git a/upgrade/1.1.0/01_new_mail.sql b/upgrade/1.1.0/01_new_mail.sql index 10bd1cf..3e8ec83 100644 --- a/upgrade/1.1.0/01_new_mail.sql +++ b/upgrade/1.1.0/01_new_mail.sql @@ -42,24 +42,24 @@ INSERT INTO email_account_emails (uid,email,type) CREATE TABLE email_nonaccount_emails ( email VARCHAR(255) NOT NULL PRIMARY KEY, - hruid VARCHAR(255) NOT NULL, + pfix_hruid VARCHAR(255) NOT NULL, type ENUM('homonym','ax','honeypot'), expire DATE NOT NULL DEFAULT '0000-00-00' ) ENGINE=InnoDB, CHARSET=utf8 ; -INSERT INTO email_nonaccount_emails (hruid,email,type) +INSERT INTO email_nonaccount_emails (pfix_hruid,email,type) SELECT CONCAT(CONCAT('h.',a.alias),'.polytechnique.org'), CONCAT(a.alias,'@polytechnique.org'),'homonym' FROM aliases AS a WHERE a.type = 'homonyme' GROUP BY (a.alias); -INSERT INTO email_nonaccount_emails (hruid,email,type) +INSERT INTO email_nonaccount_emails (pfix_hruid,email,type) SELECT CONCAT(CONCAT('h.',a.alias),'.polytechnique.org'), CONCAT(a.alias,'@m4x.org'),'homonym' FROM aliases AS a WHERE a.type = 'homonyme' GROUP BY (a.alias); -INSERT INTO email_nonaccount_emails (hruid,email,type) +INSERT INTO email_nonaccount_emails (pfix_hruid,email,type) SELECT CONCAT(CONCAT('h.',a.alias),'.polytechnique.org'), CONCAT(a.alias,'@m4x.net'),'homonym' FROM aliases AS a @@ -67,19 +67,19 @@ INSERT INTO email_nonaccount_emails (hruid,email,type) GROUP BY (a.alias); CREATE TABLE homonyms_list ( - homonym_hruid VARCHAR(255) NOT NULL, + pfix_hruid VARCHAR(255) NOT NULL, uid INT(11) UNSIGNED NOT NULL, - KEY(homonym_hruid) + KEY(pfix_hruid) ) ENGINE=InnoDB, CHARSET=utf8 ; -INSERT INTO homonyms_list (homonym_hruid,uid) +INSERT INTO homonyms_list (pfix_hruid,uid) SELECT CONCAT(CONCAT('h.',a.alias),'.polytechnique.org'), h.uid FROM homonyms AS h INNER JOIN aliases AS a ON (a.uid=h.homonyme_id) WHERE a.type = 'homonyme'; CREATE TABLE email_redirect ( - hruid VARCHAR(255) NOT NULL DEFAULT '', + pfix_hruid VARCHAR(255) NOT NULL DEFAULT '', redirect VARCHAR(255) NOT NULL DEFAULT '', rewrite VARCHAR(255) NOT NULL DEFAULT '', type ENUM('smtp','googleapps','imap','homonyms') NOT NULL DEFAULT 'smtp', @@ -96,11 +96,11 @@ CREATE TABLE email_redirect ( flags ENUM('active','panne','disable') NOT NULL, hash VARCHAR(32) DEFAULT NULL, allow_rewrite TINYINT(1) DEFAULT 0, - KEY (hruid), + KEY (pfix_hruid), KEY (redirect) ) ENGINE=InnoDB, CHARSET=utf8 ; -INSERT INTO email_redirect (hruid,redirect,rewrite,type,action, +INSERT INTO email_redirect (pfix_hruid,redirect,rewrite,type,action, panne,panne_level,last,flags,hash,allow_rewrite) SELECT a.hruid,e.email,e.rewrite,'smtp',ef.email, e.panne,e.panne_level,e.last,e.flags,e.hash,e.allow_rewrite @@ -109,24 +109,24 @@ INSERT INTO email_redirect (hruid,redirect,rewrite,type,action, LEFT JOIN accounts AS a ON (e.uid=a.uid) WHERE e.flags != 'filter' AND ef.flags = 'filter'; -INSERT INTO email_redirect (hruid,type,action,flags) - SELECT ege.hruid,'homonym','homonym','active' +INSERT INTO email_redirect (pfix_hruid,type,action,flags) + SELECT ege.pfix_hruid,'homonym','homonym','active' FROM email_nonaccount_emails AS ege WHERE ege.type = 'homonym' - GROUP BY (ege.hruid); -INSERT INTO email_redirect (hruid,type,action,flags) - SELECT ege.hruid,'smtp','default','active' + GROUP BY (ege.pfix_hruid); +INSERT INTO email_redirect (pfix_hruid,type,action,flags) + SELECT ege.pfix_hruid,'smtp','default','active' FROM email_nonaccount_emails AS ege WHERE ege.type != 'homonym' - GROUP BY (ege.hruid); -INSERT INTO email_redirect (hruid,redirect,type,action,flags) + GROUP BY (ege.pfix_hruid); +INSERT INTO email_redirect (pfix_hruid,redirect,type,action,flags) SELECT a.hruid,CONCAT(a.hruid,"@g.polytechnique.org"),'googleapps',ef.email,'active' FROM email_options AS eo LEFT JOIN accounts AS a ON (a.uid=eo.uid) LEFT JOIN emails AS ef ON (eo.uid=ef.uid) WHERE FIND_IN_SET('googleapps',eo.storage) AND ef.flags="filter"; -INSERT INTO email_redirect (hruid,redirect,type,action,flags) +INSERT INTO email_redirect (pfix_hruid,redirect,type,action,flags) SELECT a.hruid,CONCAT(a.hruid,"@imap.polytechnique.org"),'imap','let_spams','active' FROM email_options AS eo LEFT JOIN accounts AS a ON (a.uid=eo.uid) @@ -392,7 +392,7 @@ INSERT INTO email_virtual (alias,redirect,type) VALUES ("kes2000@m4x.org","kes2000@polytechnique.org","partner"), ("kes2000@m4x.net","kes2000@polytechnique.org","partner"); -INSERT INTO email_nonaccount_emails (hruid,email,type) VALUES +INSERT INTO email_nonaccount_emails (pfix_hruid,email,type) VALUES ("ax.test.polytechnique.org","AX-test@polytechnique.org","ax"), ("ax.test.polytechnique.org","AX-test@m4x.org","ax"), ("ax.test.polytechnique.org","AX-test@m4x.net","ax"), @@ -424,7 +424,7 @@ INSERT INTO email_nonaccount_emails (hruid,email,type) VALUES ("honey.jean-pierre.bilah.1980.polytechnique.org","jean-pierre.blah.1980@m4x.org","honeypot"), ("honey.jean-pierre.bilah.1980.polytechnique.org","jean-pierre.blah.1980@m4x.net","honeypot"); -INSERT INTO email_redirect (hruid,redirect,type,action,flags) VALUES +INSERT INTO email_redirect (pfix_hruid,redirect,type,action,flags) VALUES ("ax.test.polytechnique.org","falco@[129.104.217.160]","smtp","tag_spams","active"), ("ax.nicolas.zarpas.polytechnique.org","nicolas.zarpas-ax@wanadoo.fr","smtp","tag_spams","active"), ("ax.carrieres.polytechnique.org","manuela.brasseur-bdc@wanadoo.fr","smtp","tag_spams","active"),