I just installed Drupal 6, am reviewing the database model, and am not finding primary and foreign key table relationships. Is referential integrity not enforced at the database level, or am I missing something?

Thanks,
Martin

Comments

styro’s picture

Drupal supports environments that don't have it, so Drupal doesn't use it (for now).

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal

drmjsommer’s picture

Thanks, I highly recommend it in future versions (I see your "for now" comment).

Also, regarding the next comment, creating a database abstraction layer does not eliminate the ability to fully use relational database features.

Enforcing referential integrity in the database now, creates a more valuable data set for later use by other tools and systems.

Martin

alex’s picture

Any database abstraction layer throws away the best features of any specific RDBMS :/ Drupal's one is not an exception, more like a perfect example :/

HillsWeb.com

RockyRoad’s picture

In the word "abstraction", there's "abstract", which recalls Object Oriented Modeling, IMHO the key to both extensibility and portabillity.
So I can't see why it should throw away any RDBMS-specific feature.

You may consider the data abstraction layer like an abstract base class (or interface) for any database engine backend.
A generic implementation could be based on ANSI SQL and provide empty implementation for extended features.

Thus the abstraction layer can -- as soon as it presents any benefit -- provide a superset of all database implementation features.

First benefits I think of:

  • Referential integrity
  • Namespace indication (table name prefix, PG schema ...)
  • Comment for table and field descriptions

Drupal being an open community project, with loads of contributed modules of disparate coding styles, which may be installed, updated, removed so easily, I think that referential integrity of database is a critical problem.

Best regards,

ffinstad’s picture

Just started investigating Drupal 6.4. I'm shocked to see no ref integrity in the Drupal core schema. I don't understand... there's no reason not to have it.