Commit cf9d471 1 parent 236e70f commit cf9d471 Copy full SHA for cf9d471
File tree 3 files changed +37
-1
lines changed
3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,8 @@ var migrations = []Migration{
269
269
NewMigration ("Convert task type from int to string" , convertTaskTypeToString ),
270
270
// v162 -> v163
271
271
NewMigration ("Convert webhook task type from int to string" , convertWebhookTaskTypeToString ),
272
+ // v163 -> v164
273
+ NewMigration ("Convert topic name from 25 to 50" , convertTopicNameFrom25To50 ),
272
274
}
273
275
274
276
// GetCurrentDBVersion returns the current db version
Original file line number Diff line number Diff line change
1
+ // Copyright 2020 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
+ "xorm.io/xorm"
9
+ )
10
+
11
+ func convertTopicNameFrom25To50 (x * xorm.Engine ) error {
12
+ type Topic struct {
13
+ ID int64 `xorm:"pk autoincr"`
14
+ Name string `xorm:"UNIQUE VARCHAR(50)"`
15
+ RepoCount int
16
+ CreatedUnix int64 `xorm:"INDEX created"`
17
+ UpdatedUnix int64 `xorm:"INDEX updated"`
18
+ }
19
+
20
+ if err := x .Sync2 (new (Topic )); err != nil {
21
+ return err
22
+ }
23
+
24
+ sess := x .NewSession ()
25
+ defer sess .Close ()
26
+ if err := sess .Begin (); err != nil {
27
+ return err
28
+ }
29
+ if err := recreateTable (sess , new (Topic )); err != nil {
30
+ return err
31
+ }
32
+
33
+ return sess .Commit ()
34
+ }
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ var topicPattern = regexp.MustCompile(`^[a-z0-9][a-z0-9-]*$`)
26
26
// Topic represents a topic of repositories
27
27
type Topic struct {
28
28
ID int64 `xorm:"pk autoincr"`
29
- Name string `xorm:"UNIQUE VARCHAR(25 )"`
29
+ Name string `xorm:"UNIQUE VARCHAR(50 )"`
30
30
RepoCount int
31
31
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
32
32
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
You can’t perform that action at this time.
0 commit comments