]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/db/TemplateAccount.java
cascade delete of template_accounts from templates
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / TemplateAccount.java
index c662ff1c18092121ebf6f6b74bbffe1ec98be595..8651e3fee09ba66ac857788e30a62e0e04894e84 100644 (file)
@@ -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)