Properly track foreign keys for new tables