Create default tx template on upgrade.

This commit is contained in:
Kailash Nadh 2022-07-30 22:37:05 +05:30
parent cd09c5a59d
commit bbbf28c5ce

View file

@ -30,5 +30,15 @@ func V2_2_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
return err 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 return nil
} }