Skip to content

Commit 76cbc60

Browse files
committed
MySQL use Alter
1 parent d43a529 commit 76cbc60

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

models/migrations/v167.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ package migrations
77
import (
88
"xorm.io/builder"
99
"xorm.io/xorm"
10+
"xorm.io/xorm/schemas"
1011
)
1112

1213
func recreateUserTableToFixDefaultValues(x *xorm.Engine) error {
14+
switch x.Dialect().URI().DBType {
15+
case schemas.MYSQL:
16+
_, err := x.Exec("ALTER TABLE `user` MODIFY COLUMN keep_activity_private tinyint(1) DEFAULT 0 NOT NULL;")
17+
return err
18+
}
19+
1320
type User struct {
1421
ID int64 `xorm:"pk autoincr"`
1522
KeepActivityPrivate bool `xorm:"NOT NULL DEFAULT false"`

0 commit comments

Comments
 (0)