Skip to content

Commit bbbf28c

Browse files
committed
Create default tx template on upgrade.
1 parent cd09c5a commit bbbf28c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/migrations/v2.2.0.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,15 @@ func V2_2_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
3030
return err
3131
}
3232

33+
// Insert transactional template.
34+
txTpl, err := fs.Get("/static/email-templates/sample-tx.tpl")
35+
if err != nil {
36+
return err
37+
}
38+
if _, err := db.Exec(`INSERT INTO templates (name, type, subject, body) VALUES($1, $2, $3, $4)`,
39+
"Sample transactional template", "tx", "Welcome {{ .Subscriber.Name }}", txTpl.ReadBytes()); err != nil {
40+
return err
41+
}
42+
3343
return nil
3444
}

0 commit comments

Comments
 (0)