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

How i can add unique key with two fields #108

Closed
Bobsans opened this issue Mar 5, 2019 · 4 comments
Closed

How i can add unique key with two fields #108

Bobsans opened this issue Mar 5, 2019 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers Waiting for feedback

Comments

@Bobsans
Copy link

Bobsans commented Mar 5, 2019

I need to add unique key to model with 2 fields. Django offers a design _meta.unique_togetter. How i can do it with Trotoise?

@grigi
Copy link
Member

grigi commented Mar 5, 2019

Hi

Tortoise doesn't support compound indexes yet. You can simulate this by creating a compound unique index in your DB over those two tables.

I'm also tagging this as a feature request :-)

@grigi grigi added enhancement New feature or request good first issue Good for newcomers labels Mar 5, 2019
@Bobsans
Copy link
Author

Bobsans commented Mar 5, 2019

thanks :)

grigi pushed a commit that referenced this issue Mar 20, 2019
)

Added ability to use "unique_together" meta Model option like in Django (#108)
@grigi
Copy link
Member

grigi commented Mar 20, 2019

Hi @Bobsans v0.11.6 #112 should have added this feature.
Please test :-)

@Bobsans
Copy link
Author

Bobsans commented Mar 21, 2019

Yes. It's works. Thanks.

@grigi grigi closed this as completed Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers Waiting for feedback
Projects
None yet
Development

No branches or pull requests

2 participants