objectbox-java
objectbox-java copied to clipboard
[feature request] Unique/Index column collate / case-(in)sensitive
Annotation @Unique is currently missing ability to mark string unique index case-sensitive/case-insensitive, previously this function was proposed in https://github.com/objectbox/objectbox-java/issues/20#issuecomment-335006482
@Entity public class User {
@Id public long id;
@Unique(caseSensitive=true) String username;
@Unique(caseSensitive=false) String email;
}
This might as well be replaced by more manual setting of collate
@Entity public class User {
@Id public long id;
@Unique(collate=CollateType.BINARY) String username; // or none, as BINARY is default
@Unique(collate=CollateType.NOCASE) String email;
}
Could this feature be added?
Is it possible to somehow achieve schema setting (UNIQUE (email COLLATE NOCASE)) right now with ObjectBox version 2.5.0, or impossible without adding support in the library?
Thanks. Looking at the conversation in #20 I guess it was decided to keep it simple and always have a case sensitive unique index. But this was so long ago I don't remember details.
I'll guess we can leave this open for others to thumbs up.
@greenrobot-team well simplicity is one thing, but being unable to set collate for index (not just unique indexes) is imho missing functionality
See docs https://www.sqlite.org/datatype3.html#collation
Moving the discussion about improving support for other languages to #46.