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);
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With