Referential Integrity

Events happening in the community are now at Drupal community events on www.drupal.org.
drpratten's picture

CCK is making great strides towards enabling application design within Drupal. One feature that seems essential is the (optional) ability to enforce referential integrity for nodereference and userreference.

Taking up Robert's example: another real knockout criterium that prevents this from working is that there is no way to ensure that once we record that Beethoven! wrote the moonlight sonata that it stays that way. At the present, is seems that Beethoven could get deleted and leave the sonata orphaned?

If a content node A refers to node B (or user B) then Drupal could guarantee that node A does not get orphaned. This can happen in two ways. 1) Prevention of deletion of node B (user B) while the reference exists or 2) cascading the node deletion.

Comments

Relationship API

sun's picture

As already mentioned here we should stick to Relationship API and not to a separate system with minor and more importantly duplicate functionality. dman has done some great work so far which can be improved over time. Like with any other Drupal functionality it won't work out to have different modules with the same functionality. Look at events, voting or even upload/attachment/file modules - all of them do slightly the same without re-using already existing functionality. That's boredom! We have to rely on the work that is done - it makes no sense to reinvent the wheel. All maintainers of the mentioned modules are in the process of leveraging a main API for their modules now. Don't do the same mistake twice!

Just look at event module maintainers having big trouble on how to merge all overlapping modules to one events API.

Daniel F. Kudwien
unleashed mind

Daniel F. Kudwien
netzstrategen

Firm Foundations for the Future

drpratten's picture

Thanks Daniel for directing me to dman's work on recording relationships between nodes in Drupal. This is excellent stuff and as this vision is pursued it will lay a good foundation for Drupal in the future.

My "dream module" is a module that will provide rapid application development within the context of all of Drual's existing functionality. I mean application building functionality like www.dabbledb.com or www.zohocreator.com only better because it is aware of and interacts with core and compatible contributed modules e.g. user management, authentication, blogs, tags, folksonomies etc etc

I can see where you're

sun's picture

I can see where you're coming from... Although I do not believe in out-click-of-click-the-click-box-click-applications (BOFH style), since you have to customize too many things to provide a great user experience, Oracle f.e. follows this trend with Oracle Application Express, too. My suggestion is more towards having a clean framework that provides several clean APIs (but no dupes) which in turn allows contrib modules to extend the provided technology to create usable web applications.

Daniel F. Kudwien
unleashed mind

Daniel F. Kudwien
netzstrategen

Databases

mfredrickson's picture

Databases have many of these referential integrity features built in. I'd like to see more work moved to the DB level when possible. Right tool for the right job.

The difficulty comes in supporting different databases, and I don't have an easy answer.

Couldn't this be a little nodeapi magic?

Anonymous's picture

Couldn't you solve some of the referential integrity issues with a little nodeapi magic in nodereference module? You could probably even address a wee bit of the ordinality issues raised in http://groups.drupal.org/node/1323 with proper form validation.

referential integrity in hook_schema

ygyoelito's picture

Hi guys,

How can I make a referential integrity from hook_schema in the '.install' file. Which of the parameters of the arrays passed in this hook let me create an integrity, something like "ON DELETE cascade". I want to make relations between some tables, but I don't want to make it whith queries.

thanks