Break up Database::add_index

Signed-off-by: emanuele <emanuele45@gmail.com>