mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:15:43 +01:00
Alter package_version.metadata_json to LONGTEXT (#21667)
This commit is contained in:
parent
81ea4f95a0
commit
f8f859b8fa
3 changed files with 29 additions and 1 deletions
|
@ -433,6 +433,8 @@ var migrations = []Migration{
|
||||||
NewMigration("Add ConfidentialClient column (default true) to OAuth2Application table", v1_18.AddConfidentialClientColumnToOAuth2ApplicationTable),
|
NewMigration("Add ConfidentialClient column (default true) to OAuth2Application table", v1_18.AddConfidentialClientColumnToOAuth2ApplicationTable),
|
||||||
// v231 -> v232
|
// v231 -> v232
|
||||||
NewMigration("Add index for hook_task", v1_19.AddIndexForHookTask),
|
NewMigration("Add index for hook_task", v1_19.AddIndexForHookTask),
|
||||||
|
// v232 -> v233
|
||||||
|
NewMigration("Alter package_version.metadata_json to LONGTEXT", v1_19.AlterPackageVersionMetadataToLongText),
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCurrentDBVersion returns the current db version
|
// GetCurrentDBVersion returns the current db version
|
||||||
|
|
26
models/migrations/v1_19/v232.go
Normal file
26
models/migrations/v1_19/v232.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package v1_19 // nolint
|
||||||
|
|
||||||
|
import (
|
||||||
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
|
"xorm.io/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AlterPackageVersionMetadataToLongText(x *xorm.Engine) error {
|
||||||
|
sess := x.NewSession()
|
||||||
|
defer sess.Close()
|
||||||
|
if err := sess.Begin(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if setting.Database.UseMySQL {
|
||||||
|
if _, err := sess.Exec("ALTER TABLE `package_version` MODIFY COLUMN `metadata_json` LONGTEXT"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sess.Commit()
|
||||||
|
}
|
|
@ -33,7 +33,7 @@ type PackageVersion struct {
|
||||||
LowerVersion string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
LowerVersion string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
||||||
CreatedUnix timeutil.TimeStamp `xorm:"created INDEX NOT NULL"`
|
CreatedUnix timeutil.TimeStamp `xorm:"created INDEX NOT NULL"`
|
||||||
IsInternal bool `xorm:"INDEX NOT NULL DEFAULT false"`
|
IsInternal bool `xorm:"INDEX NOT NULL DEFAULT false"`
|
||||||
MetadataJSON string `xorm:"metadata_json TEXT"`
|
MetadataJSON string `xorm:"metadata_json LONGTEXT"`
|
||||||
DownloadCount int64 `xorm:"NOT NULL DEFAULT 0"`
|
DownloadCount int64 `xorm:"NOT NULL DEFAULT 0"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue