2024-01-07 01:56:32 +08:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
2024-10-31 20:38:50 +08:00
|
|
|
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
2024-01-07 01:56:32 +08:00
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
2024-05-18 17:24:14 +08:00
|
|
|
var AutoMaintainRange = []any{
|
2024-04-06 01:07:36 +08:00
|
|
|
&models.Account{},
|
2024-07-24 17:23:44 +08:00
|
|
|
&models.AccountGroup{},
|
|
|
|
&models.AccountGroupMember{},
|
2024-04-06 01:07:36 +08:00
|
|
|
&models.AuthFactor{},
|
|
|
|
&models.AccountProfile{},
|
|
|
|
&models.AccountContact{},
|
2024-07-16 00:02:28 +08:00
|
|
|
&models.AccountRelationship{},
|
2024-06-26 17:59:15 +08:00
|
|
|
&models.Status{},
|
2024-06-02 20:15:04 +08:00
|
|
|
&models.Badge{},
|
2024-05-04 01:32:44 +08:00
|
|
|
&models.Realm{},
|
|
|
|
&models.RealmMember{},
|
2024-04-20 19:04:33 +08:00
|
|
|
&models.AuthTicket{},
|
2024-04-06 01:07:36 +08:00
|
|
|
&models.MagicToken{},
|
|
|
|
&models.ThirdClient{},
|
|
|
|
&models.ActionEvent{},
|
|
|
|
&models.Notification{},
|
|
|
|
&models.NotificationSubscriber{},
|
2024-07-03 22:57:17 +08:00
|
|
|
&models.AuditRecord{},
|
2024-08-25 23:12:33 +08:00
|
|
|
&models.ApiKey{},
|
2024-11-27 21:57:10 +08:00
|
|
|
&models.CheckInRecord{},
|
2024-09-17 14:50:05 +08:00
|
|
|
&models.PreferenceNotification{},
|
2024-10-13 12:36:51 +08:00
|
|
|
&models.PreferenceAuth{},
|
2024-09-19 21:02:21 +08:00
|
|
|
&models.AbuseReport{},
|
2024-04-06 01:07:36 +08:00
|
|
|
}
|
|
|
|
|
2024-01-07 01:56:32 +08:00
|
|
|
func RunMigration(source *gorm.DB) error {
|
2024-05-18 17:24:14 +08:00
|
|
|
if err := source.AutoMigrate(AutoMaintainRange...); err != nil {
|
2024-01-07 01:56:32 +08:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|