Propel ORM, schema.xml, the missing autoIncrement value and a not working "$propelObject->reload()" with mysql greater 5.1
So i had to evaluate a migration of an existing application from mysql 5.1 to mysql 5.5. Yes i know, the gap between 5.1 and 5.5 is tremendous but the system was working without any problems for a long time of periode.
After switching a test environment from 5.1 to 5.5 there was one unittest failing. What was so special in that given unittest? For a reason, we needed to execute the native propel method "reload" right after a "save". The test was failing because of an empty value for the "id". The representing database table has a column id with an autoincrement flag. With mysql 5.1, everything is working as expected. The id was available after the reload so everything was fine.
After switching to 5.5, no id was available after calling "save". This leads to the fact that propel was failing by executing the "reload" method. Switching back to mysql 5.1 and the error was gone. After search in usergroups, issuepages i still could not find any matching issue or entry. Finally i presentend my problem on the #propel channel in freenode and got some feedback. One guy had experienced the same error in the past. He could remember that this problem occures while switching to mysql 5.3 or 5.4. Niceguy exptom wrote that goosed him with my report and he will give the problem a debug session try.
On the next day, he quickly responded and presented his results. He (if he is a he and not a she) told me he could takle it down to a missleading schema.xml. The column where the error occures had a missing autoIncrement="true" value. I took a look into my current schema.xml and bam same flaw.
The rest is quite easy. Update schema.xml, rerun propel generation and testing. Everything is now working fine. Thanks to exptom again. I guess the schema.xml would have been one of the last areas i had debugged.
Comments
Display comments as Linear | Threaded