mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-25 16:08:46 +09:00
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
34 lines
742 B
Go
34 lines
742 B
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v1_11
|
|
|
|
import (
|
|
"code.gitea.io/gitea/models/db"
|
|
"code.gitea.io/gitea/models/migrations/base"
|
|
)
|
|
|
|
func RemoveLabelUneededCols(x db.EngineMigration) error {
|
|
// Make sure the columns exist before dropping them
|
|
type Label struct {
|
|
QueryString string
|
|
IsSelected bool
|
|
}
|
|
if err := x.Sync(new(Label)); err != nil {
|
|
return err
|
|
}
|
|
|
|
sess := x.NewSession()
|
|
defer sess.Close()
|
|
if err := sess.Begin(); err != nil {
|
|
return err
|
|
}
|
|
if err := base.DropTableColumns(sess, "label", "query_string"); err != nil {
|
|
return err
|
|
}
|
|
if err := base.DropTableColumns(sess, "label", "is_selected"); err != nil {
|
|
return err
|
|
}
|
|
return sess.Commit()
|
|
}
|