syncdb doesn't create tables for m2m through-less fields that are added on the model after the class_prepared signal
|Reported by:||Ionel Cristian Maries||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2-alpha|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
It seems that syncdb adds the auto_created m2m tables only if the table for the model containing the m2m field weren't created yet.
This change was introduced in one of the multidb updates - see http://code.djangoproject.com/changeset/11710#file2
I have a weird use case here: I have a custom field that adds a m2m field on the model on the contribute_to_class call (unfortunately it happens later after the model is prepared due to some information needed from other models coupled with lazy relationships). This looks like a regression to me, 1.1 was handling this case just fine. Also, the m2m fields don't have an explicit through table (thus the auto_created flag).
Reverting back the condition in syncdb seems to solve this problem (also, the testsuite doesn't show any regression for me).