Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Index for scene_id and Url column size changes #1571

Merged
merged 2 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading