2024-02-01 15:26:17 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
2024-06-22 09:29:53 +00:00
|
|
|
"git.solsynth.dev/hydrogen/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{
|
2024-04-06 03:47:58 +00:00
|
|
|
&models.Account{},
|
|
|
|
&models.Realm{},
|
|
|
|
&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-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
|
|
|
|
}
|