X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fdb%2FTemplateAccount.java;h=f697b4dd54466431da96c383107f3e68235acf50;hb=5a514f5f9ee23a57fdd135f265f7fa095b463773;hp=c662ff1c18092121ebf6f6b74bbffe1ec98be595;hpb=3ab99e1679326277d6ba7f8ce28f17a96dfa07aa;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/db/TemplateAccount.java b/app/src/main/java/net/ktnx/mobileledger/db/TemplateAccount.java index c662ff1c..f697b4dd 100644 --- a/app/src/main/java/net/ktnx/mobileledger/db/TemplateAccount.java +++ b/app/src/main/java/net/ktnx/mobileledger/db/TemplateAccount.java @@ -30,9 +30,11 @@ import org.jetbrains.annotations.NotNull; indices = {@Index(name = "fk_template_accounts_template", value = "template_id"), @Index(name = "fk_template_accounts_currency", value = "currency") }, foreignKeys = {@ForeignKey(childColumns = "template_id", parentColumns = "id", - entity = TemplateHeader.class), + entity = TemplateHeader.class, onDelete = ForeignKey.CASCADE, + onUpdate = ForeignKey.RESTRICT), @ForeignKey(childColumns = "currency", parentColumns = "id", - entity = Currency.class) + entity = Currency.class, onDelete = ForeignKey.RESTRICT, + onUpdate = ForeignKey.RESTRICT) }) public class TemplateAccount extends TemplateBase { @PrimaryKey(autoGenerate = true) @@ -67,6 +69,20 @@ public class TemplateAccount extends TemplateBase { this.templateId = templateId; this.position = position; } + public TemplateAccount(TemplateAccount o) { + id = o.id; + templateId = o.templateId; + accountName = o.accountName; + position = o.position; + accountNameMatchGroup = o.accountNameMatchGroup; + currency = o.currency; + currencyMatchGroup = o.currencyMatchGroup; + amount = o.amount; + amountMatchGroup = o.amountMatchGroup; + accountComment = o.accountComment; + accountCommentMatchGroup = o.accountCommentMatchGroup; + negateAmount = o.negateAmount; + } public Long getId() { return id; }