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;
@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;