2024-01-06 17:56:32 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
2024-06-17 14:21:34 +00:00
|
|
|
"git.solsynth.dev/hydrogen/passport/pkg/internal/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{},
|
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{},
|
2024-07-15 16:02:28 +00:00
|
|
|
&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{},
|
2024-07-03 14:57:17 +00:00
|
|
|
&models.AuditRecord{},
|
2024-08-25 15:12:33 +00:00
|
|
|
&models.ApiKey{},
|
2024-09-02 14:12:25 +00:00
|
|
|
&models.SignRecord{},
|
2024-09-17 06:50:05 +00:00
|
|
|
&models.PreferenceNotification{},
|
2024-10-13 04:36:51 +00:00
|
|
|
&models.PreferenceAuth{},
|
2024-09-19 13:02:21 +00:00
|
|
|
&models.AbuseReport{},
|
2024-04-05 17:07:36 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|