Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migration v141 (#14387) #14388

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/migrations/v141.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func addKeepActivityPrivateUserColumn(x *xorm.Engine) error {
type User struct {
KeepActivityPrivate bool
KeepActivityPrivate bool `xorm:"NOT NULL DEFAULT false"`
}

if err := x.Sync2(new(User)); err != nil {
Expand Down
13 changes: 11 additions & 2 deletions models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ import (

"code.gitea.io/gitea/modules/setting"

// Needed for the MySQL driver
_ "github.com/go-sql-driver/mysql"
"xorm.io/builder"
"xorm.io/xorm"
"xorm.io/xorm/names"
"xorm.io/xorm/schemas"

// Needed for the MySQL driver
_ "github.com/go-sql-driver/mysql"

// Needed for the Postgresql driver
_ "github.com/lib/pq"

Expand Down Expand Up @@ -312,6 +314,13 @@ func DumpDatabase(filePath string, dbType string) error {
tbs = append(tbs, t)
}

// temporary fix for v1.13.x (https://github.com/go-gitea/gitea/issues/14069)
if _, err := x.Where(builder.IsNull{"keep_activity_private"}).
Cols("keep_activity_private").
Update(User{KeepActivityPrivate: false}); err != nil {
return err
}

type Version struct {
ID int64 `xorm:"pk autoincr"`
Version int64
Expand Down