1
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-02-02 15:09:33 -05:00

Add DefaultUnit to Repository

This commit is contained in:
6543 2024-10-28 23:39:02 +01:00
parent 348d1d0f32
commit 371cc207be
3 changed files with 15 additions and 0 deletions

View File

@ -364,6 +364,7 @@ func prepareMigrationTasks() []*migration {
newMigration(304, "Add index for release sha1", v1_23.AddIndexForReleaseSha1),
newMigration(305, "Add Repository Licenses", v1_23.AddRepositoryLicenses),
newMigration(306, "Add BlockAdminMergeOverride to ProtectedBranch", v1_23.AddBlockAdminMergeOverrideBranchProtection),
newMigration(307, "Add DefaultUnit to Repository", v1_23.AddDefaultUnitToRepository),
}
return preparedMigrations
}

View File

@ -0,0 +1,13 @@
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_23 //nolint
import "xorm.io/xorm"
func AddDefaultUnitToRepository(x *xorm.Engine) error {
type Repository struct {
DefaultUnit int `xorm:"NOT NULL DEFAULT 1"`
}
return x.Sync(new(Repository))
}

View File

@ -168,6 +168,7 @@ type Repository struct {
RenderingMetas map[string]string `xorm:"-"`
DocumentRenderingMetas map[string]string `xorm:"-"`
Units []*RepoUnit `xorm:"-"`
DefaultUnit unit.Type `xorm:"NOT NULL DEFAULT 1"`
PrimaryLanguage *LanguageStat `xorm:"-"`
IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`