Livestatus: Refactor historical tables (WIP).

Refs #5351