Skip to content

Commit

Permalink
Create default tx template on upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jul 30, 2022
1 parent cd09c5a commit bbbf28c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/migrations/v2.2.0.go
Expand Up @@ -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
}

0 comments on commit bbbf28c

Please sign in to comment.