2024-03-26 15:05:13 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.solsynth.dev/hydrogen/messaging/pkg/models"
|
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
2024-04-06 06:05:51 +00:00
|
|
|
var DatabaseAutoActionRange = []any{
|
|
|
|
&models.Account{},
|
|
|
|
&models.Channel{},
|
|
|
|
&models.ChannelMember{},
|
2024-04-06 09:08:01 +00:00
|
|
|
&models.Call{},
|
2024-04-06 06:05:51 +00:00
|
|
|
&models.Message{},
|
|
|
|
&models.Attachment{},
|
|
|
|
}
|
|
|
|
|
2024-03-26 15:05:13 +00:00
|
|
|
func RunMigration(source *gorm.DB) error {
|
2024-04-06 06:05:51 +00:00
|
|
|
if err := source.AutoMigrate(DatabaseAutoActionRange...); err != nil {
|
2024-03-26 15:05:13 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|