implement database works

Signed-off-by: Loyid Kim <thepuruya@gmail.com>