Drupal 7 provides foreign key support "for documentation purposes only."
http://drupal.org/node/146939
These declarations do not add referential integrity; however, core does make use of these foreign key declarations.

Should the following fields be declared as foreign keys?

  1. {taxonomy_access_term}.tid: these always correspond to keys in {taxonomy_term_data}.tid
  2. {taxonomy_access_default}.vid: these usually correspond to keys in {taxonomy_vocabulary}.vid, except for global default configurations, which have a vid of 0.
  3. {taxonomy_access_term}.rid and {taxonomy_access_default}.rid: Currently, these always correspond to role IDs in {role}. This might change in 7.x-2.x if we add support for access profiles or per-user configurations (as per #871572: Combine forces: merge TAC and TAC_Lite into one package in D7?, #948922: Allow cloning of TAC Fields configurations, or implement access profiles). (In that scenario, we might change the key to a "profile ID" and then save separately the correspondences between profiles and users or roles.

Comments

xjm’s picture

From IRC: Crell says declaring foreign keys in general is a good idea, and that CTools is leveraging this information. So, at least #1 above should get this. I'm still not sure about #2 and #3.