Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there!
I wanted to know if there was a specific reason about the fact that the rid
field is not set as a PRIMARY KEY
in the user_relationships
table.
What I want to do is to archive multiple relationships between a requester and a requestee.
In order to accomplish this, I am using a dedicated rtid
.
However, the existing PRIMARY KEY
(requester_id
, requestee_id
, rtid
) prevents me to do so.
This is why I want to add the rtid
field as a PRIMARY KEY
: to bypass this restriction and to have duplicates of (requester_id
, requestee_id
, rtid
).
Thanks!
Comments
Comment #1
BerdirRelationship types that go in both direction (reciprocal is it called IIRC) create two relationships with the same rid.
Comment #2
StephaneSeng CreditAttribution: StephaneSeng commentedThanks for your very quick reply!
Just to clarify things up:
From what I have understand and using your reply, there are 3 relation types.
Let
R(A, B)
be an oriented relation betweenA
andB
.The relations are either :
user_relationships
table for easier database queries using the samerid
)R(A, B)
is created,R(B, A)
is also created at the same time, with the samerid
R(A, B)
has been created,R(B, A)
cannot be realizedR(A, B)
has been created,R(B, A)
can be created, with a different ridSo the
rid
is shared for the mutual relations and not for the reciprocal ones.PS:
For my very specific need of archiving relations, adding the
rid
field in thePRIMARY KEY
set is still feasible.It reduces the set of non working cases but the existing cases of today will still work, even if the
rid
field is duplicated.Comment #2.0
StephaneSeng CreditAttribution: StephaneSeng commentedClarification of the last paragraph by using colons instead of just commas.