update database and model