Run the script.sql attached to create the database and the indexes (with primary keys and foreign keys).
Then export all the created tables and check out the schema and index file created by the export script (I attached them to this message).
The schema is alright, but the index does not create first the primary keys for all tables. Because it does not do that, the index.sql script will fail to load (it will try to create foreign keys referencing primary keys that have not been yet created within the script).
If you compare index.sql and the original script.sql you will see that the order is completely wrong and the export script is unusable in this scenario.