update db files using references for foreign keys