Passport/pkg/internal/database/migrator.go
LittleSheep 8c89d89382 Optimized audit, event logging system
 Audit logs
 Admin edit user permissions
2024-07-03 22:57:17 +08:00

34 lines
662 B
Go

package database
import (
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"gorm.io/gorm"
)
var AutoMaintainRange = []any{
&models.Account{},
&models.AuthFactor{},
&models.AccountProfile{},
&models.AccountContact{},
&models.AccountFriendship{},
&models.Status{},
&models.Badge{},
&models.Realm{},
&models.RealmMember{},
&models.AuthTicket{},
&models.MagicToken{},
&models.ThirdClient{},
&models.ActionEvent{},
&models.Notification{},
&models.NotificationSubscriber{},
&models.AuditRecord{},
}
func RunMigration(source *gorm.DB) error {
if err := source.AutoMigrate(AutoMaintainRange...); err != nil {
return err
}
return nil
}