DMPbelgium / roadmap

5 stars 1 forks source link

user.destroy fails #12

Open laurastandaert opened 2 years ago

laurastandaert commented 2 years ago

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

3.0.2

Actual behaviour:

database constraint error: answers and roles, that are attached to user_id, are not taken into account (i.e. removed before removing the user), so mysql complains:

ActiveRecord::StatementInvalid (Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails (`roadmap_dmpuat`.`answers`, CONSTRAINT `fk_rails_584be190c2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)): DELETE FROM `users` WHERE `users`.`id` = 68751)
ActiveRecord::StatementInvalid (Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails (`roadmap_dmpuat`.`roles`, CONSTRAINT `fk_rails_ab35d699f0` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)): DELETE FROM `users` WHERE `users`.`id` = 68751)

Steps to reproduce:

laurastandaert commented 2 years ago

ot urgent. Not possible to delete users through UI. Only 'Archive'

nicolasfranck commented 2 years ago

what happens if you merge accounts

nicolasfranck commented 2 years ago

no problem probably on user merge as it removes roles first