If MyISAM
doesn't have FK integrity, how does a django app that uses MyISAM
tables enforce the integrity of the FK constaints?
Django foreign key integrity with MyISAM
Asked Answered
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.
Agree. Also you now have no integrity check at the db level. So if anyone has access to the db and changes things, django is no longer involved. –
Mandamus
© 2022 - 2024 — McMap. All rights reserved.