Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Remove the foreign key constraint of the "email_tasks" table

lotkb256848f931c
diff --git a/core/internal/service/database_initialization/batch_mail.go b/core/internal/service/database_initialization/batch_mail.go
index 70ec5370..cffc277a 100644
--- a/core/internal/service/database_initialization/batch_mail.go
+++ b/core/internal/service/database_initialization/batch_mail.go
@@ -84,8 +84,7 @@ func init() {
delivered_count INTEGER NOT NULL DEFAULT 0,
bounced_count INTEGER NOT NULL DEFAULT 0,
deferred_count INTEGER NOT NULL DEFAULT 0,
- stats_update_time INTEGER NOT NULL DEFAULT 0,
- FOREIGN KEY (template_id) REFERENCES email_templates(id)
+ stats_update_time INTEGER NOT NULL DEFAULT 0
)`,
`CREATE TABLE IF NOT EXISTS recipient_info (
@@ -223,6 +222,8 @@ func init() {
_ = DropForeignKeyIfExists("unsubscribe_records", "template_id")
_ = DropForeignKeyIfExists("unsubscribe_records", "task_id")
+ _ = DropForeignKeyIfExists("email_tasks", "template_id")
+
g.Log().Info(context.Background(), "Batch mail tables initialized successfully")
})
}