I'm trying to upgrade our 0.3.1 installation to 0.4.2.
When I execute the following SQL upgrade lines, I get the errors that follow them:
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)
mysql> ALTER TABLE identities
ADD CONSTRAINT user_id_fk_identities
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_identities
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?
Alternately, is there a good way to import data from an existing older roundcube MySQL database into a fresh, up-to-date one?
Thanks!
- John
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 CONSTRAINTuser_id_fk_contacts
FOREIGN KEY (user_id
) -> REFERENCESusers
(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
, CONSTRAINTuser_id_fk_contacts
FOREIGN KEY (user_id
) REFERENCESusers
(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);