Skip to content

Commit 00dc35e

Browse files
authored
Fix migration v141 (#14387) (#14388)
* Fix mig 141 * temporary fix dump
1 parent 841efac commit 00dc35e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

models/migrations/v141.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
func addKeepActivityPrivateUserColumn(x *xorm.Engine) error {
1414
type User struct {
15-
KeepActivityPrivate bool
15+
KeepActivityPrivate bool `xorm:"NOT NULL DEFAULT false"`
1616
}
1717

1818
if err := x.Sync2(new(User)); err != nil {

models/models.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ import (
1515

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

18-
// Needed for the MySQL driver
19-
_ "github.com/go-sql-driver/mysql"
18+
"xorm.io/builder"
2019
"xorm.io/xorm"
2120
"xorm.io/xorm/names"
2221
"xorm.io/xorm/schemas"
2322

23+
// Needed for the MySQL driver
24+
_ "github.com/go-sql-driver/mysql"
25+
2426
// Needed for the Postgresql driver
2527
_ "github.com/lib/pq"
2628

@@ -312,6 +314,13 @@ func DumpDatabase(filePath string, dbType string) error {
312314
tbs = append(tbs, t)
313315
}
314316

317+
// temporary fix for v1.13.x (https://github.com/go-gitea/gitea/issues/14069)
318+
if _, err := x.Where(builder.IsNull{"keep_activity_private"}).
319+
Cols("keep_activity_private").
320+
Update(User{KeepActivityPrivate: false}); err != nil {
321+
return err
322+
}
323+
315324
type Version struct {
316325
ID int64 `xorm:"pk autoincr"`
317326
Version int64

0 commit comments

Comments
 (0)