Skip to content

Commit

Permalink
fix: Add Index for scene_id and Url column size changes (xbapps#1571)
Browse files Browse the repository at this point in the history
* DB Cahnge Index and Url column size

* Add missing migration
  • Loading branch information
toshski authored Jan 15, 2024
1 parent 4955526 commit d074f7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions pkg/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,17 @@ func Migrate() {
return tx.AutoMigrate(File{}).Error
},
},
{
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"`
}
return tx.AutoMigrate(&Scene{}).Error
},
},

// ===============================================================================================
// Put DB Schema migrations above this line and migrations that rely on the updated schema below
Expand Down
6 changes: 3 additions & 3 deletions pkg/models/model_scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type Scene struct {
UpdatedAt time.Time `json:"updated_at" xbvrbackup:"updated_at"`
DeletedAt *time.Time `sql:"index" json:"-" xbvrbackup:"-"`

SceneID string `json:"scene_id" xbvrbackup:"scene_id"`
SceneID string `gorm:"index" json:"scene_id" xbvrbackup:"scene_id"`
Title string `json:"title" sql:"type:varchar(1024);" xbvrbackup:"title"`
SceneType string `json:"scene_type" xbvrbackup:"scene_type"`
ScraperId string `json:"scraper_id" xbvrbackup:"scraper_id"`
Expand All @@ -76,8 +76,8 @@ type Scene struct {
Synopsis string `json:"synopsis" sql:"type:text;" xbvrbackup:"synopsis"`
ReleaseDate time.Time `json:"release_date" xbvrbackup:"release_date"`
ReleaseDateText string `json:"release_date_text" xbvrbackup:"release_date_text"`
CoverURL string `json:"cover_url" xbvrbackup:"cover_url"`
SceneURL string `json:"scene_url" xbvrbackup:"scene_url"`
CoverURL string `gorm:"size:500" json:"cover_url" xbvrbackup:"cover_url"`
SceneURL string `gorm:"size:500" json:"scene_url" xbvrbackup:"scene_url"`
MemberURL string `json:"members_url" xbvrbackup:"members_url"`
IsMultipart bool `json:"is_multipart" xbvrbackup:"is_multipart"`

Expand Down

0 comments on commit d074f7e

Please sign in to comment.