shish/shimmie2 — Issue #117: use foreign keys
Author: shish
Created: 2012-02-08 05:23:46+00:00
State: open

Everywhere that a foreign key makes sense, it should be used, and PHP-level code to do the same thing should be removed. For instance, when deleting an image, all the associated comments should disappear. The PHP level stuff was written years ago back before MySQL supported foreign keys, and it's a pain to maintain and doesn't even work half the time.

Note that both "on delete cascade" and "on delete restrict" should be used -- for instance, one doesn't want images disappearing from the database without the files being removed from disk, so one should set the foreign key to "on delete restrict" and then make sure to deal with the deletion of files and database entries by hand.