Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MiddleFork opened this issue Oct 7, 2016 · 2 comments
Open

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

MiddleFork opened this issue Oct 7, 2016 · 2 comments

Comments

@MiddleFork
Copy link

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
Copy link
Owner

elpaso commented Oct 8, 2016

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
Copy link

rns4731 commented Apr 4, 2020

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants