I see three subscription tables.


--
-- Table structure for table `dbmail_subscription`
--




DROP TABLE IF EXISTS `dbmail_subscription`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
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`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;


This one doesn't have *any* foreign keys. Broken!



--
-- Table structure for table `dbmail_subscription_10022008`
--

DROP TABLE IF EXISTS `dbmail_subscription_10022008`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `dbmail_subscription_10022008` (
  `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`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;


Looks like you can drop that one all together. Your call.

--
-- Table structure for table
--

DROP TABLE IF EXISTS `dbmail_subscription_com_reg_apagados`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `dbmail_subscription_com_reg_apagados` (
  `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_com_reg_apagados_ibfk_1` FOREIGN KEY
(`user_id`) REFERENCES `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON
UPDATE CASCADE,
  CONSTRAINT `dbmail_subscription_com_reg_apagados_ibfk_2` FOREIGN KEY
(`mailbox_id`) REFERENCES `dbmail_mailboxes` (`mailbox_idnr`) ON DELETE
CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;


This one is clean! Insert the data from the first into this one, ignore
all errors, drop the first, rename the third to the last, y ya esta.

So:

#> mysqldump -t dbmail dbmail_subscription > subscription_data.txt
#> mysql dbmail
mysql> drop table dbmail_subscription;
mysql> alter table dbmail_subscription_com_reg_apagados rename
dbmail_subscription;
mysql> exit;
#> mysql -f dbmail < subscription_data.txt

done.




-- 
  ________________________________________________________________
  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

Reply via email to