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
