24 lines
398 B
Go
Raw Normal View History

2024-03-26 23:05:13 +08:00
package database
import (
"git.solsynth.dev/hydrogen/messaging/pkg/internal/models"
2024-03-26 23:05:13 +08:00
"gorm.io/gorm"
)
2024-09-19 22:23:32 +08:00
var AutoMaintainRange = []any{
2024-04-06 14:05:51 +08:00
&models.Account{},
2024-05-05 00:39:59 +08:00
&models.Realm{},
2024-04-06 14:05:51 +08:00
&models.Channel{},
&models.ChannelMember{},
2024-04-06 17:08:01 +08:00
&models.Call{},
&models.Event{},
2024-04-06 14:05:51 +08:00
}
2024-03-26 23:05:13 +08:00
func RunMigration(source *gorm.DB) error {
2024-09-19 22:23:32 +08:00
if err := source.AutoMigrate(AutoMaintainRange...); err != nil {
2024-03-26 23:05:13 +08:00
return err
}
return nil
}