🐛 Fix auto migration error

This commit is contained in:
LittleSheep 2025-03-12 00:24:59 +08:00
parent f0216bf770
commit 359cb59bfe
2 changed files with 10 additions and 7 deletions
pkg/internal

@ -16,8 +16,8 @@ var AutoMaintainRange = []any{
&models.PollAnswer{},
&models.PostFlag{},
&models.PostView{},
&models.FediversePost{},
&models.FediverseUser{},
&models.FediversePost{},
}
func RunMigration(source *gorm.DB) error {

@ -1,15 +1,18 @@
package models
import "git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
"gorm.io/datatypes"
)
type FediversePost struct {
cruda.BaseModel
Identifier string `json:"identifier" gorm:"uniqueIndex"`
Origin string `json:"origin"`
Content string `json:"content"`
Language string `json:"language"`
Images []string `json:"images"`
Identifier string `json:"identifier" gorm:"uniqueIndex"`
Origin string `json:"origin"`
Content string `json:"content"`
Language string `json:"language"`
Images datatypes.JSONSlice[string] `json:"images"`
User FediverseUser `json:"user"`
UserID uint `json:"user_id"`