elpaso / django-dag

Basic portable Directed Acyclic Graph application for Django
66 stars 19 forks source link

Unique together constraint on ('child_id','parent_id') ? #21

Open MiddleFork opened 8 years ago

MiddleFork commented 8 years ago

Are duplicate child_id/parent_id pairs valid? Or should we apply a unique constraint to avoid adding the same child to the same parent more than once, as shown below:

bdipr=# select * from django_dag_edge;
 id | child_id | parent_id 
----+----------+-----------
  1 |        1 |         2
  2 |        1 |         2
(2 rows)
elpaso commented 8 years ago

Yes, I think it that adding a unique constraint makes sense. Would you mind adding a test case and making a pull request? Please make sure that concrete classes will still be able to add thier own unique constraints if needed, I'm not sure about how Django handles that.

rns4731 commented 4 years ago

+1