From 77c9b1d3579ff26ea43ab120b418ee3754e37e9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Tue, 1 Mar 2011 11:28:56 +0100 Subject: [PATCH] Adds foreign key on email_redirect_other. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- upgrade/1.1.0/01_new_mail_schema.sql | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/upgrade/1.1.0/01_new_mail_schema.sql b/upgrade/1.1.0/01_new_mail_schema.sql index 46cbd97..d0e729d 100644 --- a/upgrade/1.1.0/01_new_mail_schema.sql +++ b/upgrade/1.1.0/01_new_mail_schema.sql @@ -1,8 +1,8 @@ +DROP TABLE IF EXISTS email_redirect_account; +DROP TABLE IF EXISTS email_redirect_other; DROP TABLE IF EXISTS email_source_account; DROP TABLE IF EXISTS email_source_other; DROP TABLE IF EXISTS homonyms_list; -DROP TABLE IF EXISTS email_redirect_account; -DROP TABLE IF EXISTS email_redirect_other; DROP TABLE IF EXISTS email_virtual; DROP TABLE IF EXISTS email_virtual_domains; @@ -33,11 +33,12 @@ CREATE TABLE email_source_account ( CREATE TABLE email_source_other ( email VARCHAR(255) NOT NULL, domain SMALLINT(3) UNSIGNED NOT NULL DEFAULT 1, - hrmid VARCHAR(255) NOT NULL, + hrmid VARCHAR(255) NOT NULL DEFAULT '', type ENUM('homonym', 'ax', 'honeypot'), expire DATE DEFAULT NULL, PRIMARY KEY (email, domain), KEY (domain), + KEY(hrmid), FOREIGN KEY (domain) REFERENCES email_virtual_domains (id) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB, CHARSET=utf8; @@ -74,7 +75,8 @@ CREATE TABLE email_redirect_other ( action ENUM('default', 'drop_spams', 'let_spams', 'tag_and_drop_spams', 'tag_spams', 'imap_and_bounce', 'homonym') NOT NULL DEFAULT 'default', PRIMARY KEY (hrmid, redirect), KEY (hrmid), - KEY (redirect) + KEY (redirect), + FOREIGN KEY (hrmid) REFERENCES email_source_other (hrmid) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB, CHARSET=utf8; CREATE TABLE email_virtual ( -- 2.1.4