Update media deletion after file deletion trigger
Our current trigger is implemented as such:
"CREATE TRIGGER IF NOT EXISTS cascade_file_deletion AFTER DELETE ON "
+ File::Table::Name +
" BEGIN "
" DELETE FROM " + Media::Table::Name + " WHERE "
"(SELECT COUNT(id_file) FROM " + File::Table::Name +
" WHERE media_id=old.media_id) = 0"
" AND id_media=old.media_id;"
" END;",
However, there are multiple assumptions that a Media
must have a file of type Main
. So we could simplify this trigger by simply removing the media when the removed file type is Main
.
This requires a bump in the db model, and should preferably be done once android & iOS get out of the beta period