mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Merge remote-tracking branch 'upstream/master' into team-grant-all-repos
This commit is contained in:
@@ -21,10 +21,10 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
gouuid "github.com/satori/go.uuid"
|
||||
"github.com/unknwon/com"
|
||||
ini "gopkg.in/ini.v1"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
const minDBVersion = 4
|
||||
@@ -253,6 +253,18 @@ var migrations = []Migration{
|
||||
// v98 -> v99
|
||||
NewMigration("add original author name and id on migrated release", addOriginalAuthorOnMigratedReleases),
|
||||
// v99 -> v100
|
||||
NewMigration("add task table and status column for repository table", addTaskTable),
|
||||
// v100 -> v101
|
||||
NewMigration("update migration repositories' service type", updateMigrationServiceTypes),
|
||||
// v101 -> v102
|
||||
NewMigration("change length of some external login users columns", changeSomeColumnsLengthOfExternalLoginUser),
|
||||
// v102 -> v103
|
||||
NewMigration("update migration repositories' service type", dropColumnHeadUserNameOnPullRequest),
|
||||
// v103 -> v104
|
||||
NewMigration("Add WhitelistDeployKeys to protected branch", addWhitelistDeployKeysToBranches),
|
||||
// v104 -> v105
|
||||
NewMigration("remove unnecessary columns from label", removeLabelUneededCols),
|
||||
// v105 -> v106
|
||||
NewMigration("add includes_all_repositories to teams", addTeamIncludesAllRepositories),
|
||||
}
|
||||
|
||||
@@ -406,9 +418,11 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
|
||||
}
|
||||
for _, index := range res {
|
||||
indexName := index["column_name"]
|
||||
_, err := sess.Exec(fmt.Sprintf("DROP INDEX `%s` ON `%s`", indexName, tableName))
|
||||
if err != nil {
|
||||
return err
|
||||
if len(indexName) > 0 {
|
||||
_, err := sess.Exec(fmt.Sprintf("DROP INDEX `%s` ON `%s`", indexName, tableName))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func updateMigrationServiceTypes(x *xorm.Engine) error {
|
||||
type Repository struct {
|
||||
ID int64
|
||||
OriginalServiceType int `xorm:"index default(0)"`
|
||||
OriginalURL string `xorm:"VARCHAR(2048)"`
|
||||
}
|
||||
|
||||
if err := x.Sync2(new(Repository)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var last int
|
||||
const batchSize = 50
|
||||
for {
|
||||
var results = make([]Repository, 0, batchSize)
|
||||
err := x.Where("original_url <> '' AND original_url IS NOT NULL").
|
||||
And("original_service_type = 0 OR original_service_type IS NULL").
|
||||
OrderBy("id").
|
||||
Limit(batchSize, last).
|
||||
Find(&results)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(results) == 0 {
|
||||
break
|
||||
}
|
||||
last += len(results)
|
||||
|
||||
const PlainGitService = 1 // 1 plain git service
|
||||
const GithubService = 2 // 2 github.com
|
||||
|
||||
for _, res := range results {
|
||||
u, err := url.Parse(res.OriginalURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var serviceType = PlainGitService
|
||||
if strings.EqualFold(u.Host, "github.com") {
|
||||
serviceType = GithubService
|
||||
}
|
||||
_, err = x.Exec("UPDATE repository SET original_service_type = ? WHERE id = ?", serviceType, res.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type ExternalLoginUser struct {
|
||||
ExternalID string `xorm:"pk NOT NULL"`
|
||||
UserID int64 `xorm:"INDEX NOT NULL"`
|
||||
LoginSourceID int64 `xorm:"pk NOT NULL"`
|
||||
RawData map[string]interface{} `xorm:"TEXT JSON"`
|
||||
Provider string `xorm:"index VARCHAR(25)"`
|
||||
Email string
|
||||
Name string
|
||||
FirstName string
|
||||
LastName string
|
||||
NickName string
|
||||
Description string
|
||||
AvatarURL string
|
||||
Location string
|
||||
AccessToken string
|
||||
AccessTokenSecret string
|
||||
RefreshToken string
|
||||
ExpiresAt time.Time
|
||||
}
|
||||
|
||||
return x.Sync2(new(ExternalLoginUser))
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func changeSomeColumnsLengthOfExternalLoginUser(x *xorm.Engine) error {
|
||||
type ExternalLoginUser struct {
|
||||
AccessToken string `xorm:"TEXT"`
|
||||
AccessTokenSecret string `xorm:"TEXT"`
|
||||
RefreshToken string `xorm:"TEXT"`
|
||||
}
|
||||
|
||||
return x.Sync2(new(ExternalLoginUser))
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func dropColumnHeadUserNameOnPullRequest(x *xorm.Engine) error {
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
return dropTableColumns(sess, "pull_request", "head_user_name")
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addWhitelistDeployKeysToBranches(x *xorm.Engine) error {
|
||||
type ProtectedBranch struct {
|
||||
ID int64
|
||||
WhitelistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
|
||||
return x.Sync2(new(ProtectedBranch))
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeLabelUneededCols(x *xorm.Engine) error {
|
||||
|
||||
// Make sure the columns exist before dropping them
|
||||
type Label struct {
|
||||
QueryString string
|
||||
IsSelected bool
|
||||
}
|
||||
if err := x.Sync2(new(Label)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
if err := sess.Begin(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := dropTableColumns(sess, "label", "query_string"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := dropTableColumns(sess, "label", "is_selected"); err != nil {
|
||||
return err
|
||||
}
|
||||
return sess.Commit()
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addTeamIncludesAllRepositories(x *xorm.Engine) error {
|
||||
|
||||
type Team struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IncludesAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
|
||||
if err := x.Sync2(new(Team)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := x.Exec("UPDATE `team` SET `includes_all_repositories` = ? WHERE `name`=?",
|
||||
true, "Owners")
|
||||
return err
|
||||
}
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"github.com/unknwon/com"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func ldapUseSSLToSecurityProtocol(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func setCommentUpdatedWithCreated(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func createAllowCreateOrganizationColumn(x *xorm.Engine) error {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/markup"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// Enumerate all the unit types
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func setProtectedBranchUpdatedWithCreated(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// ExternalLoginUser makes the connecting between some existing user and additional external login sources
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"github.com/unknwon/com"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func generateAndMigrateGitHooks(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func useNewNameAvatars(x *xorm.Engine) error {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"github.com/unknwon/com"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"github.com/unknwon/com"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func generateAndMigrateWikiGitHooks(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// UserOpenID is the list of all OpenID identities of a user.
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func changeGPGKeysColumns(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addUserOpenIDShow(x *xorm.Engine) error {
|
||||
|
||||
@@ -16,8 +16,8 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"github.com/unknwon/com"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func generateAndMigrateGitHookChains(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func convertIntervalToDuration(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addRepoSize(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// CommitStatus see models/status.go
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addExternalLoginUserPK(x *xorm.Engine) error {
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/core"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addLoginSourceSyncEnabledColumn(x *xorm.Engine) error {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addUnitsToRepoTeam(x *xorm.Engine) error {
|
||||
type Team struct {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeActionColumns(x *xorm.Engine) error {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// Team see models/team.go
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addCommentIDToAction(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"code.gitea.io/gitea/models"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func regenerateGitHooks36(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"html"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func unescapeUserFullNames(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/core"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeCommitsUnitType(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// ReleaseV39 describes the added field for Release
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func fixProtectedBranchCanPushValue(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeDuplicateUnitTypes(x *xorm.Engine) error {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeIndexColumnFromRepoUnitTable(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeOrganizationWatchRepo(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addDeletedBranch(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addRepoIndexerStatus(x *xorm.Engine) error {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addTimetracking(x *xorm.Engine) error {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func migrateProtectedBranchStruct(x *xorm.Engine) error {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addDefaultValueToUserProhibitLogin(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addLFSLock(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addReactions(x *xorm.Engine) error {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addPullRequestOptions(x *xorm.Engine) error {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addModeToDeploKeys(x *xorm.Engine) error {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeIsOwnerColumnFromOrgUser(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addIssueClosedTime(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addLabelsDescriptions(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addProtectedBranchMergeWhitelist(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addFsckEnabledToRepo(x *xorm.Engine) error {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addSizeToAttachment(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addLastUsedPasscodeTOTP(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addLanguageSetting(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addMultipleAssignees(x *xorm.Engine) error {
|
||||
|
||||
@@ -3,7 +3,7 @@ package migrations
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addU2FReg(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addLoginSourceIDToPublicKeyTable(x *xorm.Engine) error {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeStaleWatches(x *xorm.Engine) error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
var topicPattern = regexp.MustCompile(`^[a-z0-9][a-z0-9-]*$`)
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func moveTeamUnitsToTeamUnitTable(x *xorm.Engine) error {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addIssueDependencies(x *xorm.Engine) (err error) {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"code.gitea.io/gitea/modules/generate"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addScratchHash(x *xorm.Engine) error {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addReview(x *xorm.Engine) error {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addMustChangePassword(x *xorm.Engine) error {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addApprovalWhitelistsToProtectedBranches(x *xorm.Engine) error {
|
||||
type ProtectedBranch struct {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func clearNonusedData(x *xorm.Engine) error {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addPullRequestRebaseWithMerge(x *xorm.Engine) error {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addUserDefaultTheme(x *xorm.Engine) error {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func renameRepoIsBareToIsEmpty(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addCanCloseIssuesViaCommitInAnyBranch(x *xorm.Engine) error {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addIsLockedToIssues(x *xorm.Engine) error {
|
||||
// Issue see models/issue.go
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func changeU2FCounterType(x *xorm.Engine) error {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func fixReleaseSha1OnReleaseTable(x *xorm.Engine) error {
|
||||
|
||||
@@ -7,7 +7,7 @@ package migrations
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addUploaderIDForAttachment(x *xorm.Engine) error {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addGPGKeyImport(x *xorm.Engine) error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func hashAppToken(x *xorm.Engine) error {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addHTTPMethodToWebhook(x *xorm.Engine) error {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addAvatarFieldToRepository(x *xorm.Engine) error {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func hashContext(context string) string {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addOriginalMigrationInfo(x *xorm.Engine) error {
|
||||
// Issue see models/issue.go
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func changeSomeColumnsLengthOfRepo(x *xorm.Engine) error {
|
||||
type Repository struct {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addIndexOnRepositoryAndComment(x *xorm.Engine) error {
|
||||
type Repository struct {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func removeLingeringIndexStatus(x *xorm.Engine) error {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addEmailNotificationEnabledToUser(x *xorm.Engine) error {
|
||||
// User see models/user.go
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addStatusCheckColumnsForProtectedBranches(x *xorm.Engine) error {
|
||||
type ProtectedBranch struct {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addCrossReferenceColumns(x *xorm.Engine) error {
|
||||
// Comment see models/comment.go
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func deleteOrphanedAttachments(x *xorm.Engine) error {
|
||||
@@ -27,7 +27,7 @@ func deleteOrphanedAttachments(x *xorm.Engine) error {
|
||||
defer sess.Close()
|
||||
|
||||
err := sess.BufferSize(setting.Database.IterateBufferSize).
|
||||
Where("`comment_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))").Cols("uuid").
|
||||
Where("`issue_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))").Cols("uuid").
|
||||
Iterate(new(Attachment),
|
||||
func(idx int, bean interface{}) error {
|
||||
attachment := bean.(*Attachment)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addRepoAdminChangeTeamAccessColumnForUser(x *xorm.Engine) error {
|
||||
type User struct {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "github.com/go-xorm/xorm"
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addOriginalAuthorOnMigratedReleases(x *xorm.Engine) error {
|
||||
type Release struct {
|
||||
|
||||
+20
-11
@@ -5,21 +5,30 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addTeamIncludesAllRepositories(x *xorm.Engine) error {
|
||||
|
||||
type Team struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IncludesAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
|
||||
func addTaskTable(x *xorm.Engine) error {
|
||||
type Task struct {
|
||||
ID int64
|
||||
DoerID int64 `xorm:"index"` // operator
|
||||
OwnerID int64 `xorm:"index"` // repo owner id, when creating, the repoID maybe zero
|
||||
RepoID int64 `xorm:"index"`
|
||||
Type structs.TaskType
|
||||
Status structs.TaskStatus `xorm:"index"`
|
||||
StartTime timeutil.TimeStamp
|
||||
EndTime timeutil.TimeStamp
|
||||
PayloadContent string `xorm:"TEXT"`
|
||||
Errors string `xorm:"TEXT"` // if task failed, saved the error reason
|
||||
Created timeutil.TimeStamp `xorm:"created"`
|
||||
}
|
||||
|
||||
if err := x.Sync2(new(Team)); err != nil {
|
||||
return err
|
||||
type Repository struct {
|
||||
Status int `xorm:"NOT NULL DEFAULT 0"`
|
||||
}
|
||||
|
||||
_, err := x.Exec("UPDATE `team` SET `includes_all_repositories` = ? WHERE `name`=?",
|
||||
true, "Owners")
|
||||
return err
|
||||
return x.Sync2(new(Task), new(Repository))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user