Django and its MySQL databases
My old database's tables were MyISAM. On my new server, MySQL by default uses InnoDB, which I understand is preferable.
However, when I ask Django tp a new table, on a database on the new server (which still contains lots of MyISAM tables imported from the old database) it creates them with foreign key contraints.
They then don't work. I can't save or do anything with them, without provoking errors like:
(1452, 'Cannot add or update a child row: a foreign key constraint fails (`pre2_test`.`cmsplugin_imagesetplugin`, CONSTRAINT `cmsplugin_ptr_id_refs_id_9346966b4b4d8e9` FOREIGN KEY (`cmsplugin_ptr_id`) REFERENCES `cms_cmsplugin` (`id`))')
If I delete the constraints in the database, then everything works again, even if I leave the tables as InnoDB.
So how to proceed from here?
If InnoDB is going to be difficult about foreign key relations, as <https://docs.djangoproject.com/en/dev/ref/databases/#storage-engines> suggests, then I'd prefer to use MyISAM, which I guess means working out how to reconfigure MySQL.
It has been suggested to convert all the tables to InnoDB: <http://djangosaur.tumblr.com/post/357759467/django-transaction-mysql-engine-innodb>.
I don't know if that will solve the problem, but even if it does, then presumably only some - the new ones - of the tables in the database representing FKs on my models will have the database's constraints.
Does it even matter to have tables without those constraints? Django seemed to manage quite happily without them so far?
Many thanks for any suggestions,
Daniele
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home