File tree Expand file tree Collapse file tree 5 files changed +38
-4
lines changed Expand file tree Collapse file tree 5 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ type GPGKey struct {
3333 OwnerID int64 `xorm:"INDEX NOT NULL"`
3434 KeyID string `xorm:"INDEX CHAR(16) NOT NULL"`
3535 PrimaryKeyID string `xorm:"CHAR(16)"`
36- Content string `xorm:"TEXT NOT NULL"`
36+ Content string `xorm:"MEDIUMTEXT NOT NULL"`
3737 CreatedUnix timeutil.TimeStamp `xorm:"created"`
3838 ExpiredUnix timeutil.TimeStamp
3939 AddedUnix timeutil.TimeStamp
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ type PublicKey struct {
4141 OwnerID int64 `xorm:"INDEX NOT NULL"`
4242 Name string `xorm:"NOT NULL"`
4343 Fingerprint string `xorm:"INDEX NOT NULL"`
44- Content string `xorm:"TEXT NOT NULL"`
44+ Content string `xorm:"MEDIUMTEXT NOT NULL"`
4545 Mode perm.AccessMode `xorm:"NOT NULL DEFAULT 2"`
4646 Type KeyType `xorm:"NOT NULL DEFAULT 1"`
4747 LoginSourceID int64 `xorm:"NOT NULL DEFAULT 0"`
Original file line number Diff line number Diff line change @@ -406,8 +406,13 @@ var migrations = []Migration{
406406 NewMigration ("Drop old CredentialID column" , dropOldCredentialIDColumn ),
407407 // v223 -> v224
408408 NewMigration ("Rename CredentialIDBytes column to CredentialID" , renameCredentialIDBytes ),
409+
410+ // Gitea 1.17.0 ends at v224
411+
409412 // v224 -> v225
410- NewMigration ("Add badges to users" , creatUserBadgesTable ),
413+ NewMigration ("Add badges to users" , createUserBadgesTable ),
414+ // v225 -> v226
415+ NewMigration ("Alter gpg_key/public_key content TEXT fields to MEDIUMTEXT" , alterPublicGPGKeyContentFieldsToMediumText ),
411416}
412417
413418// GetCurrentDBVersion returns the current db version
Original file line number Diff line number Diff line change 88 "xorm.io/xorm"
99)
1010
11- func creatUserBadgesTable (x * xorm.Engine ) error {
11+ func createUserBadgesTable (x * xorm.Engine ) error {
1212 type Badge struct {
1313 ID int64 `xorm:"pk autoincr"`
1414 Description string
Original file line number Diff line number Diff line change 1+ // Copyright 2022 The Gitea Authors. All rights reserved.
2+ // Use of this source code is governed by a MIT-style
3+ // license that can be found in the LICENSE file.
4+
5+ package migrations
6+
7+ import (
8+ "code.gitea.io/gitea/modules/setting"
9+
10+ "xorm.io/xorm"
11+ )
12+
13+ func alterPublicGPGKeyContentFieldsToMediumText (x * xorm.Engine ) error {
14+ sess := x .NewSession ()
15+ defer sess .Close ()
16+ if err := sess .Begin (); err != nil {
17+ return err
18+ }
19+
20+ if setting .Database .UseMySQL {
21+ if _ , err := sess .Exec ("ALTER TABLE `gpg_key` CHANGE `content` `content` MEDIUMTEXT" ); err != nil {
22+ return err
23+ }
24+ if _ , err := sess .Exec ("ALTER TABLE `public_key` CHANGE `content` `content` MEDIUMTEXT" ); err != nil {
25+ return err
26+ }
27+ }
28+ return sess .Commit ()
29+ }
You can’t perform that action at this time.
0 commit comments