Fixed linking table deactivate

Added separate logic for deactivating linking tables versus regular
tables with foreign keys.