update database code