Skip to content

Commit bec9950

Browse files
guillep2kzeripath
authored andcommitted
Add missing columns to repository and user (#9861)
1 parent 948dec3 commit bec9950

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ var migrations = []Migration{
302302
NewMigration("Add Require Signed Commits to ProtectedBranch", addRequireSignedCommits),
303303
// v123 -> v124
304304
NewMigration("Add original informations for reactions", addReactionOriginals),
305+
// v124 -> v125
306+
NewMigration("Add columns to user and repository", addUserRepoMissingColumns),
305307
}
306308

307309
// Migrate database to current version

models/migrations/v124.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2020 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 addUserRepoMissingColumns(x *xorm.Engine) error {
12+
13+
type VisibleType int
14+
type User struct {
15+
PasswdHashAlgo string `xorm:"NOT NULL DEFAULT 'pbkdf2'"`
16+
Visibility VisibleType `xorm:"NOT NULL DEFAULT 0"`
17+
}
18+
19+
type Repository struct {
20+
IsArchived bool `xorm:"INDEX"`
21+
Topics []string `xorm:"TEXT JSON"`
22+
}
23+
24+
return x.Sync2(new(User), new(Repository))
25+
}

0 commit comments

Comments
 (0)