move database finalize and update db to config.ru
add ad model