Is it possible to have string as unique value whil...
# orm-help
h
Is it possible to have string as unique value while make it case insensitive? I mean that there can only be one username with the same characters, no matter what case?
r
@Halvor đź‘‹ What happens if two users have the same username with a different case? A
@unique
constraint wouldn’t work then. So this isn’t technically possible. One thing you could do is keep all username’s consistently in lowercase to make it easier.
h
I see. I am using POSTGRES as database, would it be possible if using the native type CITEXT?
r
I don’t think so.
unique
always will throw a constraint error if the two values match so I’m not sure how to go about this.