Passport/pkg/internal/database/migrator.go

37 lines
739 B
Go
Raw Normal View History

2024-01-06 17:56:32 +00:00
package database
import (
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
2024-01-06 17:56:32 +00:00
"gorm.io/gorm"
)
var AutoMaintainRange = []any{
2024-04-05 17:07:36 +00:00
&models.Account{},
2024-07-24 09:23:44 +00:00
&models.AccountGroup{},
&models.AccountGroupMember{},
2024-04-05 17:07:36 +00:00
&models.AuthFactor{},
&models.AccountProfile{},
&models.AccountContact{},
&models.AccountRelationship{},
2024-06-26 09:59:15 +00:00
&models.Status{},
2024-06-02 12:15:04 +00:00
&models.Badge{},
2024-05-03 17:32:44 +00:00
&models.Realm{},
&models.RealmMember{},
2024-04-20 11:04:33 +00:00
&models.AuthTicket{},
2024-04-05 17:07:36 +00:00
&models.MagicToken{},
&models.ThirdClient{},
&models.ActionEvent{},
&models.Notification{},
&models.NotificationSubscriber{},
&models.AuditRecord{},
&models.ApiKey{},
2024-04-05 17:07:36 +00:00
}
2024-01-06 17:56:32 +00:00
func RunMigration(source *gorm.DB) error {
if err := source.AutoMigrate(AutoMaintainRange...); err != nil {
2024-01-06 17:56:32 +00:00
return err
}
return nil
}