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

Replying on discussions with any posts throws exception #11

Closed MichaelBelgium closed 5 years ago

MichaelBelgium commented 5 years ago

Problem: JUST AFTER you did the migration and you try to reply on a discussion which have more than 0 replies it throws an exception. The first time it won't work. The second time it does.

[2018-12-06 22:45:58] production.ERROR: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2-2' for key 'posts_discussion_id_number_unique' in /home/vagrant/flarum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117

Cause: Initially post_number_index (in table discussions) doesn't get set in the mybb to flarum migration. It does update the value after the first try of submitting a reply.

Solution: update the field post_number_index in the migration