feat AutoMigrate
All checks were successful
Build image / build (push) Successful in 7m41s

This commit is contained in:
timerzz 2024-05-14 17:04:27 +08:00
parent 0bf6080f25
commit f2e60182df

View File

@ -29,6 +29,11 @@ func NewController(client *coach_client.Client, db *gorm.DB) *Controller {
return ctl return ctl
} }
func (c *Controller) AutoMigrate() {
if err := c.db.AutoMigrate(&database.Product{}, &database.HistoryPrice{}, &Option{}); err != nil {
panic(err)
}
}
func (c *Controller) Run(ctx context.Context) { func (c *Controller) Run(ctx context.Context) {
c.ctx = ctx c.ctx = ctx
ticker := time.NewTicker(c.Interval) ticker := time.NewTicker(c.Interval)