迁移公告,邮件

This commit is contained in:
2026-08-13 22:04:27 +08:00
parent 21c264fcd7
commit 9044bafdff
18 changed files with 946 additions and 28 deletions
+7 -1
View File
@@ -18,7 +18,7 @@ import (
)
// ProviderSet is data providers.
var ProviderSet = wire.NewSet(NewData, NewAdminRepo, NewSystemRepo, NewAccessRepo, NewSettingsRepo, NewVersionRepo, NewExportRepo, NewAuditRepo, NewTaskRepo, NewMediaRepo, NewCache, NewFileStorage)
var ProviderSet = wire.NewSet(NewData, NewAdminRepo, NewSystemRepo, NewAccessRepo, NewSettingsRepo, NewVersionRepo, NewExportRepo, NewAuditRepo, NewTaskRepo, NewMediaRepo, NewAnnouncementRepo, NewEmailRepo, NewCache, NewFileStorage)
// Data is a struct that contains the database client.
type Data struct {
@@ -41,6 +41,12 @@ func NewData(c *conf.Data) (*Data, func(), error) {
_ = db.Close()
return nil, nil, err
}
// The announcement module owns its table lifecycle independently of the
// first-run database initializer.
if err = gormDB.AutoMigrate(&announcementPO{}); err != nil {
_ = db.Close()
return nil, nil, fmt.Errorf("migrate announcement table: %w", err)
}
var redisClient *redis.Client
if c.Redis != nil && c.Redis.Addr != "" {
options := &redis.Options{Addr: c.Redis.Addr}