Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

realm unique constraint on several fields

In Realm ORM, Android. Is there any way to add unique constraint on two or more fields? Couldn't find it in documentation. SQlite example : CREATE TABLE a (i INT, j INT, UNIQUE(i, j) ON CONFLICT REPLACE);

like image 976
Autocrab Avatar asked Oct 30 '22 21:10

Autocrab


1 Answers

Realm currently doesn't support the unique constraint, but it is on our roadmap. Currently the closest is @PrimaryKey which has slightly different semantics.

You can follow the feature request here: https://github.com/realm/realm-java/issues/967

like image 183
Christian Melchior Avatar answered Nov 15 '22 05:11

Christian Melchior