move update_db to main.py.