MichaelBelgium / mybb_to_flarum

A Flarum extension to convert a mybb forum to a fresh flarum install
MIT License
26 stars 15 forks source link

Migrating threads and posts with users assigns them to wrong user #17

Closed Vaalyn closed 5 years ago

Vaalyn commented 5 years ago

When migrating threads and posts together with users the threads and the posts will be assigned as created by the user with the uid from myBB which is not the same in flarum if a user was ever deleted in myBB. This can (and in my case) let the migration fail with the following error due to the user not existing in flarum:

Next Illuminate\Database\QueryException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`forum`.`posts`, CONSTRAINT `posts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL) (SQL: insert into `posts` (`is_approved`, `created_at`, `discussion_id`, `user_id`, `type`, `ip_address`, `content`, `number`, `is_private`) values (1, 2015-05-30 23:08:34, 160, 73, comment, , Test, 2, 0)) in /var/www/forum/vendor/illuminate/database/Connection.php:664