Skip to content

Commit

Permalink
fix: Increase size of TrailerSource and ExternalData (xbapps#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
toshski authored Apr 2, 2024
1 parent b7de0cc commit a21431a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions pkg/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,19 @@ func Migrate() {
return tx.AutoMigrate(ExternalReference{}).Error
},
},
{
ID: "0077-trailer-source-and-external-data-size-change",
Migrate: func(tx *gorm.DB) error {
if models.GetDBConn().Driver == "mysql" {
err := tx.Debug().Model(&models.Scene{}).ModifyColumn("trailer_source", "longtext").Error
if err != nil {
return err
}
return tx.Model(&models.ExternalReference{}).ModifyColumn("external_data", "longtext").Error
}
return nil
},
},

// ===============================================================================================
// Put DB Schema migrations above this line and migrations that rely on the updated schema below
Expand Down
2 changes: 1 addition & 1 deletion pkg/models/model_external_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ExternalReference struct {
ExternalId string `json:"external_id" gorm:"index" xbvrbackup:"external_id"`
ExternalURL string `json:"external_url" gorm:"size:1000" xbvrbackup:"external_url"`
ExternalDate time.Time `json:"external_date" xbvrbackup:"external_date"`
ExternalData string `json:"external_data" sql:"type:text;" xbvrbackup:"external_data"`
ExternalData string `json:"external_data" sql:"type:longtext;" xbvrbackup:"external_data"`
UdfBool1 bool `json:"udf_bool1" xbvrbackup:"udf_bool1"` // user defined fields, use depends what type of data the extref is for.
UdfBool2 bool `json:"udf_bool2" xbvrbackup:"udf_bool2"`
UdfDatetime1 time.Time `json:"udf_datetime1" xbvrbackup:"udf_datetime1"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/models/model_scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ type Scene struct {
NeedsUpdate bool `json:"needs_update" xbvrbackup:"-"`
EditsApplied bool `json:"edits_applied" gorm:"default:false" xbvrbackup:"-"`
TrailerType string `json:"trailer_type" xbvrbackup:"trailer_type"`
TrailerSource string `gorm:"size:1000" json:"trailer_source" xbvrbackup:"trailer_source"`
TrailerSource string `json:"trailer_source" sql:"type:longtext;" xbvrbackup:"trailer_source"`
ChromaKey string `json:"passthrough" xbvrbackup:"passthrough"`
Trailerlist bool `json:"trailerlist" gorm:"default:false" xbvrbackup:"trailerlist"`
IsSubscribed bool `json:"is_subscribed" gorm:"default:false"`
Expand Down

0 comments on commit a21431a

Please sign in to comment.