Skip to content

Commit

Permalink
fix: Use sql rather than automigrate to create index (xbapps#1632)
Browse files Browse the repository at this point in the history
  • Loading branch information
toshski authored Feb 12, 2024
1 parent 455f2d0 commit 98c8ca7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,10 +760,12 @@ func Migrate() {
ID: "0073-scene-_id-index-plus-columns_size_changes",
Migrate: func(tx *gorm.DB) error {
type Scene struct {
SceneID string `gorm:"index" json:"scene_id" xbvrbackup:"scene_id"`
CoverURL string `gorm:"size:500" json:"cover_url" xbvrbackup:"cover_url"`
SceneURL string `gorm:"size:500" json:"scene_url" xbvrbackup:"scene_url"`
}

sql := `CREATE INDEX idx_scenes_scene_id ON scenes (scene_id)`
tx.Exec(sql)
return tx.AutoMigrate(&Scene{}).Error
},
},
Expand Down

0 comments on commit 98c8ca7

Please sign in to comment.