Interactive/pkg/database/migrator.go
2024-02-09 15:19:43 +08:00

26 lines
450 B
Go

package database
import (
"code.smartsheep.studio/hydrogen/interactive/pkg/models"
"gorm.io/gorm"
)
func RunMigration(source *gorm.DB) error {
if err := source.AutoMigrate(
&models.Account{},
&models.AccountMembership{},
&models.Realm{},
&models.RealmMember{},
&models.Category{},
&models.Tag{},
&models.Post{},
&models.PostLike{},
&models.PostDislike{},
&models.Attachment{},
); err != nil {
return err
}
return nil
}