From a21431a86aab8b18269c5ea5b16d4c064e804c5e Mon Sep 17 00:00:00 2001 From: toshski <104477758+toshski@users.noreply.github.com> Date: Wed, 3 Apr 2024 04:01:54 +1300 Subject: [PATCH] fix: Increase size of TrailerSource and ExternalData (#1658) --- pkg/migrations/migrations.go | 13 +++++++++++++ pkg/models/model_external_reference.go | 2 +- pkg/models/model_scene.go | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pkg/migrations/migrations.go b/pkg/migrations/migrations.go index 6facfa8dd..0623ca51a 100644 --- a/pkg/migrations/migrations.go +++ b/pkg/migrations/migrations.go @@ -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 diff --git a/pkg/models/model_external_reference.go b/pkg/models/model_external_reference.go index 63fac928d..340c2f9e3 100644 --- a/pkg/models/model_external_reference.go +++ b/pkg/models/model_external_reference.go @@ -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"` diff --git a/pkg/models/model_scene.go b/pkg/models/model_scene.go index 66edfb0d3..07417bb99 100644 --- a/pkg/models/model_scene.go +++ b/pkg/models/model_scene.go @@ -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"`