Skip to content

Commit e92552a

Browse files
jolheiserlunny
andauthored
noop (#14521)
Signed-off-by: jolheiser <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent 0cd87d6 commit e92552a

File tree

1 file changed

+3
-98
lines changed

1 file changed

+3
-98
lines changed

models/migrations/v168.go

+3-98
Original file line numberDiff line numberDiff line change
@@ -4,103 +4,8 @@
44

55
package migrations
66

7-
import (
8-
"xorm.io/builder"
9-
"xorm.io/xorm"
10-
"xorm.io/xorm/schemas"
11-
)
7+
import "xorm.io/xorm"
128

13-
func recreateUserTableToFixDefaultValues(x *xorm.Engine) error {
14-
type User struct {
15-
ID int64 `xorm:"pk autoincr"`
16-
LowerName string `xorm:"UNIQUE NOT NULL"`
17-
Name string `xorm:"UNIQUE NOT NULL"`
18-
FullName string
19-
Email string `xorm:"NOT NULL"`
20-
KeepEmailPrivate bool
21-
EmailNotificationsPreference string `xorm:"VARCHAR(20) NOT NULL DEFAULT 'enabled'"`
22-
Passwd string `xorm:"NOT NULL"`
23-
PasswdHashAlgo string `xorm:"NOT NULL DEFAULT 'argon2'"`
24-
25-
MustChangePassword bool `xorm:"NOT NULL DEFAULT false"`
26-
27-
LoginType int
28-
LoginSource int64 `xorm:"NOT NULL DEFAULT 0"`
29-
LoginName string
30-
Type int
31-
Location string
32-
Website string
33-
Rands string `xorm:"VARCHAR(10)"`
34-
Salt string `xorm:"VARCHAR(10)"`
35-
Language string `xorm:"VARCHAR(5)"`
36-
Description string
37-
38-
CreatedUnix int64 `xorm:"INDEX created"`
39-
UpdatedUnix int64 `xorm:"INDEX updated"`
40-
LastLoginUnix int64 `xorm:"INDEX"`
41-
42-
LastRepoVisibility bool
43-
MaxRepoCreation int `xorm:"NOT NULL DEFAULT -1"`
44-
45-
// Permissions
46-
IsActive bool `xorm:"INDEX"`
47-
IsAdmin bool
48-
IsRestricted bool `xorm:"NOT NULL DEFAULT false"`
49-
AllowGitHook bool
50-
AllowImportLocal bool
51-
AllowCreateOrganization bool `xorm:"DEFAULT true"`
52-
ProhibitLogin bool `xorm:"NOT NULL DEFAULT false"`
53-
54-
// Avatar
55-
Avatar string `xorm:"VARCHAR(2048) NOT NULL"`
56-
AvatarEmail string `xorm:"NOT NULL"`
57-
UseCustomAvatar bool
58-
59-
// Counters
60-
NumFollowers int
61-
NumFollowing int `xorm:"NOT NULL DEFAULT 0"`
62-
NumStars int
63-
NumRepos int
64-
65-
// For organization
66-
NumTeams int
67-
NumMembers int
68-
Visibility int `xorm:"NOT NULL DEFAULT 0"`
69-
RepoAdminChangeTeamAccess bool `xorm:"NOT NULL DEFAULT false"`
70-
71-
// Preferences
72-
DiffViewStyle string `xorm:"NOT NULL DEFAULT ''"`
73-
Theme string `xorm:"NOT NULL DEFAULT ''"`
74-
KeepActivityPrivate bool `xorm:"NOT NULL DEFAULT false"`
75-
}
76-
77-
if _, err := x.Where(builder.IsNull{"keep_activity_private"}).
78-
Cols("keep_activity_private").
79-
Update(User{KeepActivityPrivate: false}); err != nil {
80-
return err
81-
}
82-
83-
switch x.Dialect().URI().DBType {
84-
case schemas.MYSQL:
85-
_, err := x.Exec("ALTER TABLE `user` MODIFY COLUMN keep_activity_private tinyint(1) DEFAULT 0 NOT NULL;")
86-
return err
87-
case schemas.POSTGRES:
88-
if _, err := x.Exec("ALTER TABLE `user` ALTER COLUMN keep_activity_private SET NOT NULL;"); err != nil {
89-
return err
90-
}
91-
_, err := x.Exec("ALTER TABLE `user` ALTER COLUMN keep_activity_private SET DEFAULT false;")
92-
return err
93-
}
94-
95-
sess := x.NewSession()
96-
defer sess.Close()
97-
if err := sess.Begin(); err != nil {
98-
return err
99-
}
100-
101-
if err := recreateTable(sess, new(User)); err != nil {
102-
return err
103-
}
104-
105-
return sess.Commit()
9+
func recreateUserTableToFixDefaultValues(_ *xorm.Engine) error {
10+
return nil
10611
}

0 commit comments

Comments
 (0)