Skip to content

Commit 371cc20

Browse files
committed
Add DefaultUnit to Repository
1 parent 348d1d0 commit 371cc20

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

models/migrations/migrations.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ func prepareMigrationTasks() []*migration {
364364
newMigration(304, "Add index for release sha1", v1_23.AddIndexForReleaseSha1),
365365
newMigration(305, "Add Repository Licenses", v1_23.AddRepositoryLicenses),
366366
newMigration(306, "Add BlockAdminMergeOverride to ProtectedBranch", v1_23.AddBlockAdminMergeOverrideBranchProtection),
367+
newMigration(307, "Add DefaultUnit to Repository", v1_23.AddDefaultUnitToRepository),
367368
}
368369
return preparedMigrations
369370
}

models/migrations/v1_23/v307.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2024 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_23 //nolint
5+
6+
import "xorm.io/xorm"
7+
8+
func AddDefaultUnitToRepository(x *xorm.Engine) error {
9+
type Repository struct {
10+
DefaultUnit int `xorm:"NOT NULL DEFAULT 1"`
11+
}
12+
return x.Sync(new(Repository))
13+
}

models/repo/repo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ type Repository struct {
168168
RenderingMetas map[string]string `xorm:"-"`
169169
DocumentRenderingMetas map[string]string `xorm:"-"`
170170
Units []*RepoUnit `xorm:"-"`
171+
DefaultUnit unit.Type `xorm:"NOT NULL DEFAULT 1"`
171172
PrimaryLanguage *LanguageStat `xorm:"-"`
172173

173174
IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`

0 commit comments

Comments
 (0)