Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Create default tx template on upgrade.

Kailash Nadhbbbf28c5ce98
diff --git a/internal/migrations/v2.2.0.go b/internal/migrations/v2.2.0.go
index 21082949..94c0adfe 100644
--- a/internal/migrations/v2.2.0.go
+++ b/internal/migrations/v2.2.0.go
@@ -30,5 +30,15 @@ func V2_2_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
return err
}
+ // Insert transactional template.
+ txTpl, err := fs.Get("/static/email-templates/sample-tx.tpl")
+ if err != nil {
+ return err
+ }
+ if _, err := db.Exec(`INSERT INTO templates (name, type, subject, body) VALUES($1, $2, $3, $4)`,
+ "Sample transactional template", "tx", "Welcome {{ .Subscriber.Name }}", txTpl.ReadBytes()); err != nil {
+ return err
+ }
+
return nil
}