|
|
@ -431,16 +431,16 @@ public abstract class DB extends RoomDatabase {
|
|
|
|
" BEGIN" +
|
|
|
|
" BEGIN" +
|
|
|
|
" UPDATE message SET attachments = attachments + 1" +
|
|
|
|
" UPDATE message SET attachments = attachments + 1" +
|
|
|
|
" WHERE message.id = NEW.message" +
|
|
|
|
" WHERE message.id = NEW.message" +
|
|
|
|
" AND (NEW.encryption IS NULL" +
|
|
|
|
" AND NEW.encryption IS NULL" +
|
|
|
|
" AND NOT ((NEW.disposition = 'inline' OR NEW.cid IS NOT NULL) AND NEW.type IN (" + images + ")));" +
|
|
|
|
" AND NOT ((NEW.disposition = 'inline' OR NEW.cid IS NOT NULL) AND NEW.type IN (" + images + "));" +
|
|
|
|
" END");
|
|
|
|
" END");
|
|
|
|
db.execSQL("CREATE TRIGGER IF NOT EXISTS attachment_delete" +
|
|
|
|
db.execSQL("CREATE TRIGGER IF NOT EXISTS attachment_delete" +
|
|
|
|
" AFTER DELETE ON attachment" +
|
|
|
|
" AFTER DELETE ON attachment" +
|
|
|
|
" BEGIN" +
|
|
|
|
" BEGIN" +
|
|
|
|
" UPDATE message SET attachments = attachments - 1" +
|
|
|
|
" UPDATE message SET attachments = attachments - 1" +
|
|
|
|
" WHERE message.id = OLD.message" +
|
|
|
|
" WHERE message.id = OLD.message" +
|
|
|
|
" AND (OLD.encryption IS NULL" +
|
|
|
|
" AND OLD.encryption IS NULL" +
|
|
|
|
" AND NOT ((OLD.disposition = 'inline' OR OLD.cid IS NOT NULL) AND OLD.type IN (" + images + ")));" +
|
|
|
|
" AND NOT ((OLD.disposition = 'inline' OR OLD.cid IS NOT NULL) AND OLD.type IN (" + images + "));" +
|
|
|
|
" END");
|
|
|
|
" END");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|