add plpgsql triggers to maintain media_stats data; update web app for removed media_stats fields; add tests for media_stats triggers