Interactive/pkg/internal/database/migrator.go

26 lines
409 B
Go
Raw Permalink Normal View History

2024-02-01 15:26:17 +00:00
package database
import (
2024-11-02 05:41:51 +00:00
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
2024-02-01 15:26:17 +00:00
"gorm.io/gorm"
)
2024-05-15 11:45:49 +00:00
var AutoMaintainRange = []any{
&models.Publisher{},
2024-04-06 03:47:58 +00:00
&models.Category{},
&models.Tag{},
2024-05-15 11:45:49 +00:00
&models.Post{},
2024-04-06 03:47:58 +00:00
&models.Reaction{},
2024-09-16 16:12:09 +00:00
&models.Subscription{},
2024-04-06 03:47:58 +00:00
}
2024-02-01 15:26:17 +00:00
func RunMigration(source *gorm.DB) error {
if err := source.AutoMigrate(
2024-05-15 11:45:49 +00:00
AutoMaintainRange...,
2024-02-01 15:26:17 +00:00
); err != nil {
return err
}
return nil
}