X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fdb%2FCurrency.java;h=855244396b3e9ca641c7d6ae3552c906305c39a1;hb=880f0348558f1edff451cea49cd57a7688e291d5;hp=02e47760ecccfc3596213af8936326957017cda0;hpb=e376844a097462eda7562d30e3f542b88f139bda;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/db/Currency.java b/app/src/main/java/net/ktnx/mobileledger/db/Currency.java index 02e47760..85524439 100644 --- a/app/src/main/java/net/ktnx/mobileledger/db/Currency.java +++ b/app/src/main/java/net/ktnx/mobileledger/db/Currency.java @@ -20,9 +20,12 @@ package net.ktnx.mobileledger.db; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; import androidx.room.Entity; +import androidx.room.Ignore; +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; @@ -33,6 +36,13 @@ public class Currency { @NonNull @ColumnInfo(name = "has_gap") private Boolean hasGap; + @Ignore + public Currency() { + id = 0; + name = ""; + position = "after"; + hasGap = true; + } public Currency(long id, @NonNull String name, @NonNull String position, @NonNull Boolean hasGap) { this.id = id;