Migrating from 1.6.5 to 1.8.5

The most troublesome bit of code when it comes to migrating a Dokeos 1.6.x portal to a Dokeos 1.8.x version, is without doubt the learning paths bit, represented by the main/install/update-db-scorm-1.6.x-1.8.0.inc.php script. The fact that it may look like the script is wrong sometimes (because it fails and leaves your database in a somewhat broken state), the problem actually comes down to the original database's integrity. For example, you might get an error saying this:
SQL error in file /var/www/dokeos/main/install/update-db-scorm-1.6.x-1.8.0.inc.php at line 604.