2024-01-06 17:56:32 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
2024-04-13 05:48:19 +00:00
|
|
|
"git.solsynth.dev/hydrogen/passport/pkg/models"
|
2024-01-06 17:56:32 +00:00
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
2024-05-18 09:24:14 +00:00
|
|
|
var AutoMaintainRange = []any{
|
2024-04-05 17:07:36 +00:00
|
|
|
&models.Account{},
|
|
|
|
&models.AuthFactor{},
|
|
|
|
&models.AccountProfile{},
|
|
|
|
&models.AccountPage{},
|
|
|
|
&models.AccountContact{},
|
|
|
|
&models.AccountFriendship{},
|
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{},
|
|
|
|
}
|
|
|
|
|
2024-01-06 17:56:32 +00:00
|
|
|
func RunMigration(source *gorm.DB) error {
|
2024-05-18 09:24:14 +00:00
|
|
|
if err := source.AutoMigrate(AutoMaintainRange...); err != nil {
|
2024-01-06 17:56:32 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|