diff options
Diffstat (limited to 'models/migrations/v15.go')
-rw-r--r-- | models/migrations/v15.go | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/models/migrations/v15.go b/models/migrations/v15.go index e29067c980..3492a7190b 100644 --- a/models/migrations/v15.go +++ b/models/migrations/v15.go @@ -10,21 +10,15 @@ import ( "github.com/go-xorm/xorm" ) -// UserV15 describes the added field for User -type UserV15 struct { - KeepEmailPrivate bool - AllowCreateOrganization bool -} - -// TableName will be invoked by XORM to customrize the table name -func (*UserV15) TableName() string { - return "user" -} - func createAllowCreateOrganizationColumn(x *xorm.Engine) error { - if err := x.Sync2(new(UserV15)); err != nil { + type User struct { + KeepEmailPrivate bool + AllowCreateOrganization bool + } + + if err := x.Sync2(new(User)); err != nil { return fmt.Errorf("Sync2: %v", err) - } else if _, err = x.Where("type=0").Cols("allow_create_organization").Update(&UserV15{AllowCreateOrganization: true}); err != nil { + } else if _, err = x.Where("`type` = 0").Cols("allow_create_organization").Update(&User{AllowCreateOrganization: true}); err != nil { return fmt.Errorf("set allow_create_organization: %v", err) } return nil |