]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/db/Currency.java
add unique index on currencies(name)
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / Currency.java
index 02e47760ecccfc3596213af8936326957017cda0..9a541e7d0ecc2142bde8b6df852ae0b01f183a0d 100644 (file)
@@ -20,9 +20,11 @@ package net.ktnx.mobileledger.db;
 import androidx.annotation.NonNull;
 import androidx.room.ColumnInfo;
 import androidx.room.Entity;
+import androidx.room.Index;
 import androidx.room.PrimaryKey;
 
-@Entity(tableName = "currencies")
+@Entity(tableName = "currencies",
+        indices = {@Index(name = "currency_name_idx", unique = true, value = "name")})
 public class Currency {
     @PrimaryKey(autoGenerate = true)
     private long id;