Paul!
Ok after a few time thinking... I know what made this.
I had the missing foreign keys that's a fact, but the problem of having
mailbox's without the it's corresponding value in the subscription, is from
my system to create email, I'm inserting values in:

Dbmail_users
Dbmail_aliases
Dbmail_mailboxes

And should be creating the dbmail_subscription .... damn!

Do you know any way to create the missing values in dbmail_subscription or
will I have to do it one by one?



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Paul J Stevens
Sent: domingo, 10 de Fevereiro de 2008 18:20
To: DBMail mailinglist
Subject: Re: [Dbmail] DBMail 2.3.2 released

Jorge Bastos wrote:
> Hum right,
> Now it is correct.
> 
> CREATE TABLE `dbmail_subscription` (
>   `user_id` bigint(21) NOT NULL,
>   `mailbox_id` bigint(21) NOT NULL,
>   PRIMARY KEY  (`user_id`,`mailbox_id`),
>   KEY `user_id_index` (`user_id`),
>   KEY `mailbox_id_index` (`mailbox_id`),
>   CONSTRAINT `dbmail_subscription_ibfk_1` FOREIGN KEY (`user_id`)
REFERENCES
> `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON UPDATE CASCADE,
>   CONSTRAINT `dbmail_subscription_ibfk_2` FOREIGN KEY (`mailbox_id`)
> REFERENCES `dbmail_mailboxes` (`mailbox_idnr`) ON DELETE CASCADE ON UPDATE
> CASCADE
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8
> 
> 
> But, I was checking and I have a lot of records without a mailbox, the
> select I did was:
> 
> ---
> select *,(select count(*) from dbmail_mailboxes where
> mailbox_idnr=mailbox_id) as tot from dbmail_subscription having tot=0; 
> ---
> And I have 286 records, that has no existing connection to
dbmail_mailboxes.
> Can I safely delete this records from dbmail_subscriptions?

Of course. Subscriptions to non-existant mailboxes can and should be
removed.

-- 
  ________________________________________________________________
  Paul Stevens                                      paul at nfg.nl
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands________________________________http://www.nfg.nl
_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to