Fix foreign key checks for db dump