update db first