Code review comment for lp:~widelands-dev/widelands-website/django1_11

kaputtnik (franku) wrote :

The update is made on the productive website. I've encountered some problems in the database:

When applying the migrations i got some foreign constraints error:

django.db.utils.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`wl_django`.`#sql-2d6_4516`, CONSTRAINT
                                                                                                          `notification_noticesetting_user_id_4fab85e6_fk` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`))')

After searching the web i found the problem: The table notification_noticesetting had rows with a 'user_id' which does not exist in auth_user (probably deleted user). The solution was to find the rows in notification_noticesetting which have no corresponding user in auth_user and delete those rows (16 rows). I've checked if the users really doesn't exist in auth_user before deleting the rows.

Same problem appeared for the table wlprofile_profile (one row).

After deleting such rows the migrate command runs through (puhhh).

SirVer: Any remarks?

The changes are not commited so far and the tracking related tables aren't deleted yet.

« Back to merge proposal