File tree Expand file tree Collapse file tree 3 files changed +40
-4
lines changed Expand file tree Collapse file tree 3 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,10 @@ type Label struct {
6868 Color string `xorm:"VARCHAR(7)"`
6969 NumIssues int
7070 NumClosedIssues int
71- NumOpenIssues int `xorm:"-"`
72- IsChecked bool `xorm:"-"`
73- QueryString string
74- IsSelected bool
71+ NumOpenIssues int `xorm:"-"`
72+ IsChecked bool `xorm:"-"`
73+ QueryString string `xorm:"-"`
74+ IsSelected bool `xorm:"-"`
7575}
7676
7777// APIFormat converts a Label to the api.Label format
Original file line number Diff line number Diff line change @@ -262,6 +262,8 @@ var migrations = []Migration{
262262 NewMigration ("update migration repositories' service type" , dropColumnHeadUserNameOnPullRequest ),
263263 // v103 -> v104
264264 NewMigration ("Add WhitelistDeployKeys to protected branch" , addWhitelistDeployKeysToBranches ),
265+ // v104 -> v105
266+ NewMigration ("remove unnecessary columns from label" , removeLabelUneededCols ),
265267}
266268
267269// Migrate database to current version
Original file line number Diff line number Diff line change 1+ // Copyright 2019 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 removeLabelUneededCols (x * xorm.Engine ) error {
12+
13+ // Make sure the columns exist before dropping them
14+ type Label struct {
15+ QueryString string
16+ IsSelected bool
17+ }
18+ if err := x .Sync2 (new (Label )); err != nil {
19+ return err
20+ }
21+
22+ sess := x .NewSession ()
23+ defer sess .Close ()
24+ if err := sess .Begin (); err != nil {
25+ return err
26+ }
27+ if err := dropTableColumns (sess , "label" , "query_string" ); err != nil {
28+ return err
29+ }
30+ if err := dropTableColumns (sess , "label" , "is_selected" ); err != nil {
31+ return err
32+ }
33+ return sess .Commit ()
34+ }
You can’t perform that action at this time.
0 commit comments