cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Is there any way to prevent nodes used for dependent entities to become totally disconnected?

cristiscu
Node Clone

@andrew.bowman has a great example when such a dependent entity (a report card node) should always be created with a relationship to its parent (a student node). But you can later delete its relationship, and leave a report unrelated to anyone.

Relational databases emulate dependent entities with PKs including the PK of their parent. And you can make sure, with CASCADE DELETE/UPDATE, no child will remain without its parent.

I'm only curious if there is anything in Neo4j to prevent deleting the last relationship to such a node emulating a dependent entity.

1 ACCEPTED SOLUTION

There's no native functionality for such constraints at the present time.

You may need to create your own triggers for such a thing, or do occasional sweep queries for child nodes lacking the expected relationship to the parent, then delete.

View solution in original post

2 REPLIES 2

There's no native functionality for such constraints at the present time.

You may need to create your own triggers for such a thing, or do occasional sweep queries for child nodes lacking the expected relationship to the parent, then delete.

But that's exactly what I was looking for!

Thanks,
-C

PS: I could have never imagine I'll find triggers implemented in APOC, through functions Looks great!