On 08.12.2010 15:10, John May wrote:
> I'm trying to upgrade our 0.3.1 installation to 0.4.2.

> mysql> ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` 
> FOREIGN KEY (`user_id`)
>      ->  REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
> ERROR 1452 (23000): Cannot add or update a child row: a foreign key 
> constraint fails (`pis_roundcube/#sql-36e8_638`, CONSTRAINT 
> `user_id_fk_contacts` FOREIGN KEY (`user_id`) REFERENCES `users` 
> (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE)
> 
> The first 2 ALTER TABLE commands work OK, and I've verified all tables 
> have been changed to InnoDB.  Any ideas on how to get this to work?

There are four ALTER TABLE ... DROP FOREIGN KEY ... Did you execute them?

> Alternately, is there a good way to import data from an existing older 
> roundcube MySQL database into a fresh, up-to-date one?

What MySQL version? Check
SELECT COUNT(*) FROM identities WHERE user_id NOT IN (
     SELECT user_id FROM users);
SELECT COUNT(*) FROM contacts WHERE user_id NOT IN (
     SELECT user_id FROM users);

-- 
Aleksander 'A.L.E.C' Machniak
LAN Management System Developer [http://lms.org.pl]
Roundcube Webmail Developer  [http://roundcube.net]
---------------------------------------------------
PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl
_______________________________________________
List info: http://lists.roundcube.net/users/
BT/8f4f07cd

Reply via email to