summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2021-01-29 09:52:13 -0600
committerGitHub <noreply@github.com>2021-01-29 23:52:13 +0800
commite92552abb4801994df72a38f6fbc1ffd80c8081a (patch)
tree5a7c7aa77e3a3eb9266b5507976942969867d292
parent0cd87d64ff8bb40520877d3a217363de299f4531 (diff)
downloadgitea-e92552abb4801994df72a38f6fbc1ffd80c8081a.tar.gz
gitea-e92552abb4801994df72a38f6fbc1ffd80c8081a.zip
noop (#14521)
Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
-rw-r--r--models/migrations/v168.go101
1 files changed, 3 insertions, 98 deletions
diff --git a/models/migrations/v168.go b/models/migrations/v168.go
index 246b120d33..c34bb1d405 100644
--- a/models/migrations/v168.go
+++ b/models/migrations/v168.go
@@ -4,103 +4,8 @@
package migrations
-import (
- "xorm.io/builder"
- "xorm.io/xorm"
- "xorm.io/xorm/schemas"
-)
+import "xorm.io/xorm"
-func recreateUserTableToFixDefaultValues(x *xorm.Engine) error {
- type User struct {
- ID int64 `xorm:"pk autoincr"`
- LowerName string `xorm:"UNIQUE NOT NULL"`
- Name string `xorm:"UNIQUE NOT NULL"`
- FullName string
- Email string `xorm:"NOT NULL"`
- KeepEmailPrivate bool
- EmailNotificationsPreference string `xorm:"VARCHAR(20) NOT NULL DEFAULT 'enabled'"`
- Passwd string `xorm:"NOT NULL"`
- PasswdHashAlgo string `xorm:"NOT NULL DEFAULT 'argon2'"`
-
- MustChangePassword bool `xorm:"NOT NULL DEFAULT false"`
-
- LoginType int
- LoginSource int64 `xorm:"NOT NULL DEFAULT 0"`
- LoginName string
- Type int
- Location string
- Website string
- Rands string `xorm:"VARCHAR(10)"`
- Salt string `xorm:"VARCHAR(10)"`
- Language string `xorm:"VARCHAR(5)"`
- Description string
-
- CreatedUnix int64 `xorm:"INDEX created"`
- UpdatedUnix int64 `xorm:"INDEX updated"`
- LastLoginUnix int64 `xorm:"INDEX"`
-
- LastRepoVisibility bool
- MaxRepoCreation int `xorm:"NOT NULL DEFAULT -1"`
-
- // Permissions
- IsActive bool `xorm:"INDEX"`
- IsAdmin bool
- IsRestricted bool `xorm:"NOT NULL DEFAULT false"`
- AllowGitHook bool
- AllowImportLocal bool
- AllowCreateOrganization bool `xorm:"DEFAULT true"`
- ProhibitLogin bool `xorm:"NOT NULL DEFAULT false"`
-
- // Avatar
- Avatar string `xorm:"VARCHAR(2048) NOT NULL"`
- AvatarEmail string `xorm:"NOT NULL"`
- UseCustomAvatar bool
-
- // Counters
- NumFollowers int
- NumFollowing int `xorm:"NOT NULL DEFAULT 0"`
- NumStars int
- NumRepos int
-
- // For organization
- NumTeams int
- NumMembers int
- Visibility int `xorm:"NOT NULL DEFAULT 0"`
- RepoAdminChangeTeamAccess bool `xorm:"NOT NULL DEFAULT false"`
-
- // Preferences
- DiffViewStyle string `xorm:"NOT NULL DEFAULT ''"`
- Theme string `xorm:"NOT NULL DEFAULT ''"`
- KeepActivityPrivate bool `xorm:"NOT NULL DEFAULT false"`
- }
-
- if _, err := x.Where(builder.IsNull{"keep_activity_private"}).
- Cols("keep_activity_private").
- Update(User{KeepActivityPrivate: false}); err != nil {
- return err
- }
-
- switch x.Dialect().URI().DBType {
- case schemas.MYSQL:
- _, err := x.Exec("ALTER TABLE `user` MODIFY COLUMN keep_activity_private tinyint(1) DEFAULT 0 NOT NULL;")
- return err
- case schemas.POSTGRES:
- if _, err := x.Exec("ALTER TABLE `user` ALTER COLUMN keep_activity_private SET NOT NULL;"); err != nil {
- return err
- }
- _, err := x.Exec("ALTER TABLE `user` ALTER COLUMN keep_activity_private SET DEFAULT false;")
- return err
- }
-
- sess := x.NewSession()
- defer sess.Close()
- if err := sess.Begin(); err != nil {
- return err
- }
-
- if err := recreateTable(sess, new(User)); err != nil {
- return err
- }
-
- return sess.Commit()
+func recreateUserTableToFixDefaultValues(_ *xorm.Engine) error {
+ return nil
}