Fix the last_activity_timestamp query to work with MySQL.
Fix the last_activity_timestamp query to work with MySQL.

The query requires wrapping ORDER BY with something like MAX() when
using PostgreSQL, and it works fine with sqlite as well, but MySQL has
problems with it where it will return an empty set when used against a
review request with no reviews, so we need to use it conditionally.

It's an ugly hack.  Post-1.0, we really should just store a timestamp
along with the ReviewRequest containing the last activity. The problem
is that we end up bumping last_updated during migrations, which is bad,
so we need to somehow be clever with this and only update last_updated
when we absolutely have to.




custode/reviewboard,reviewboard/reviewboard,custode/reviewboard,atagar/ReviewBoard,chipx86/reviewboard,chipx86/reviewboard,KnowNo/reviewboard,beol/reviewboard,1tush/reviewboard,1tush/reviewboard,beol/reviewboard,reviewboard/reviewboard,atagar/ReviewBoard,brennie/reviewboard,chazy/reviewboard,chazy/reviewboard,atagar/ReviewBoard,sgallagher/reviewboard,KnowNo/reviewboard,1tush/reviewboard,chazy/reviewboard,bkochendorfer/reviewboard,1tush/reviewboard,chazy/reviewboard,asutherland/opc-reviewboard,custode/reviewboard,asutherland/opc-reviewboard,Khan/reviewboard,bkochendorfer/reviewboard,chazy/reviewboard,chazy/reviewboard,asutherland/opc-reviewboard,KnowNo/reviewboard,beol/reviewboard,1tush/reviewboard,KnowNo/reviewboard,1tush/reviewboard,atagar/ReviewBoard,Khan/reviewboard,atagar/ReviewBoard,sgallagher/reviewboard,atagar/ReviewBoard,custode/reviewboard,atagar/ReviewBoard,reviewboard/reviewboard,atagar/ReviewBoard,Khan/reviewboard,1tush/reviewboard,bkochendorfer/reviewboard,davidt/reviewboard,Khan/reviewboard,chazy/reviewboard,sgallagher/reviewboard,Khan/reviewboard,bkochendorfer/reviewboard,Khan/reviewboard,brennie/reviewboard,davidt/reviewboard,chipx86/reviewboard,chazy/reviewboard,atagar/ReviewBoard,chazy/reviewboard,brennie/reviewboard,brennie/reviewboard,1tush/reviewboard,asutherland/opc-reviewboard,reviewboard/reviewboard,1tush/reviewboard,davidt/reviewboard,sgallagher/reviewboard,Khan/reviewboard,Khan/reviewboard,chipx86/reviewboard,beol/reviewboard,davidt/reviewboard,Khan/reviewboard