Reputation: 110432
If MyISAM
doesn't have FK integrity, how does a django app that uses MyISAM
tables enforce the integrity of the FK constaints?
Upvotes: 5
Views: 610
Reputation: 156258
Poorly. It does its level best to issue updates and deletes when the referant changes, based on information it has already loaded from prior interactions, but there's just nothing protecting your data from becoming inconsistent.
The ForeignKey
construct exists less to declare the integrity constraints as it does to tell django how the different tables link together, so you can traverse in python through the attributes to other model instances of other types. The orm-driven cascading is at best a band-aid over the shortcomings of databases like MyISAM. If this is important to you (and it should be), you should migrate away from the MyISAM engine to InnoDB or PostgreSQL.
Upvotes: 10