2024-03-26 15:05:13 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
2024-11-02 05:24:37 +00:00
|
|
|
"git.solsynth.dev/hypernet/messaging/pkg/internal/models"
|
2024-11-02 05:40:37 +00:00
|
|
|
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
2024-03-26 15:05:13 +00:00
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
2024-09-19 14:23:32 +00:00
|
|
|
var AutoMaintainRange = []any{
|
2024-11-02 05:40:37 +00:00
|
|
|
&authm.Realm{},
|
2024-04-06 06:05:51 +00:00
|
|
|
&models.Channel{},
|
|
|
|
&models.ChannelMember{},
|
2024-04-06 09:08:01 +00:00
|
|
|
&models.Call{},
|
2024-06-27 14:38:18 +00:00
|
|
|
&models.Event{},
|
2024-04-06 06:05:51 +00:00
|
|
|
}
|
|
|
|
|
2024-03-26 15:05:13 +00:00
|
|
|
func RunMigration(source *gorm.DB) error {
|
2024-09-19 14:23:32 +00:00
|
|
|
if err := source.AutoMigrate(AutoMaintainRange...); err != nil {
|
2024-03-26 15:05:13 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|