piccolo_admin icon indicating copy to clipboard operation
piccolo_admin copied to clipboard

Unique Together

Open Shuttle25 opened this issue 3 years ago • 1 comments

Hi! Thanks for the last update! While building our app we faced one more lack of functionality in the ORM

Do you have plans to implement "unique together" feature (for two or more fields)? Even sqlite supports it, very useful thing

The same in django, https://stackoverflow.com/questions/2201598/how-to-define-two-fields-unique-as-couple

Shuttle25 avatar Oct 14 '22 20:10 Shuttle25

@shattl You're right, this needs adding.

There's a PR for it currently - https://github.com/piccolo-orm/piccolo/pull/582, which is quite close to be being done.

So hopefully it won't be too long.

In the mean time, you can get around it using a migration with raw SQL for adding / deleting the unique together constraints.

dantownsend avatar Oct 14 '22 20:10 dantownsend