Passport/pkg/database/migrator.go

31 lines
613 B
Go
Raw Normal View History

2024-01-06 17:56:32 +00:00
package database
import (
2024-03-20 12:56:43 +00:00
"git.solsynth.dev/hydrogen/identity/pkg/models"
2024-01-06 17:56:32 +00:00
"gorm.io/gorm"
)
2024-04-05 17:07:36 +00:00
var DatabaseAutoActionRange = []any{
&models.Account{},
&models.AuthFactor{},
&models.AccountProfile{},
&models.AccountPage{},
&models.AccountContact{},
&models.AccountFriendship{},
&models.AuthSession{},
&models.AuthChallenge{},
&models.MagicToken{},
&models.ThirdClient{},
&models.ActionEvent{},
&models.Notification{},
&models.NotificationSubscriber{},
}
2024-01-06 17:56:32 +00:00
func RunMigration(source *gorm.DB) error {
2024-04-05 17:07:36 +00:00
if err := source.AutoMigrate(DatabaseAutoActionRange...); err != nil {
2024-01-06 17:56:32 +00:00
return err
}
return nil
}