File tree 5 files changed +38
-4
lines changed
5 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ type GPGKey struct {
33
33
OwnerID int64 `xorm:"INDEX NOT NULL"`
34
34
KeyID string `xorm:"INDEX CHAR(16) NOT NULL"`
35
35
PrimaryKeyID string `xorm:"CHAR(16)"`
36
- Content string `xorm:"TEXT NOT NULL"`
36
+ Content string `xorm:"MEDIUMTEXT NOT NULL"`
37
37
CreatedUnix timeutil.TimeStamp `xorm:"created"`
38
38
ExpiredUnix timeutil.TimeStamp
39
39
AddedUnix timeutil.TimeStamp
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ type PublicKey struct {
41
41
OwnerID int64 `xorm:"INDEX NOT NULL"`
42
42
Name string `xorm:"NOT NULL"`
43
43
Fingerprint string `xorm:"INDEX NOT NULL"`
44
- Content string `xorm:"TEXT NOT NULL"`
44
+ Content string `xorm:"MEDIUMTEXT NOT NULL"`
45
45
Mode perm.AccessMode `xorm:"NOT NULL DEFAULT 2"`
46
46
Type KeyType `xorm:"NOT NULL DEFAULT 1"`
47
47
LoginSourceID int64 `xorm:"NOT NULL DEFAULT 0"`
Original file line number Diff line number Diff line change @@ -406,8 +406,13 @@ var migrations = []Migration{
406
406
NewMigration ("Drop old CredentialID column" , dropOldCredentialIDColumn ),
407
407
// v223 -> v224
408
408
NewMigration ("Rename CredentialIDBytes column to CredentialID" , renameCredentialIDBytes ),
409
+
410
+ // Gitea 1.17.0 ends at v224
411
+
409
412
// 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 ),
411
416
}
412
417
413
418
// GetCurrentDBVersion returns the current db version
Original file line number Diff line number Diff line change 8
8
"xorm.io/xorm"
9
9
)
10
10
11
- func creatUserBadgesTable (x * xorm.Engine ) error {
11
+ func createUserBadgesTable (x * xorm.Engine ) error {
12
12
type Badge struct {
13
13
ID int64 `xorm:"pk autoincr"`
14
14
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