Messaging/pkg/database/migrator.go
2024-04-06 17:08:01 +08:00

24 lines
408 B
Go

package database
import (
"git.solsynth.dev/hydrogen/messaging/pkg/models"
"gorm.io/gorm"
)
var DatabaseAutoActionRange = []any{
&models.Account{},
&models.Channel{},
&models.ChannelMember{},
&models.Call{},
&models.Message{},
&models.Attachment{},
}
func RunMigration(source *gorm.DB) error {
if err := source.AutoMigrate(DatabaseAutoActionRange...); err != nil {
return err
}
return nil
}