Add history database.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>