mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Split migrations folder (#21549)
There are too many files in `models/migrations` folder so that I split them into sub folders.
This commit is contained in:
43
models/migrations/v1_16/v205.go
Normal file
43
models/migrations/v1_16/v205.go
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package v1_16 //nolint
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
func MigrateUserPasswordSalt(x *xorm.Engine) error {
|
||||
dbType := x.Dialect().URI().DBType
|
||||
// For SQLITE, the max length doesn't matter.
|
||||
if dbType == schemas.SQLITE {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := base.ModifyColumn(x, "user", &schemas.Column{
|
||||
Name: "rands",
|
||||
SQLType: schemas.SQLType{
|
||||
Name: "VARCHAR",
|
||||
},
|
||||
Length: 32,
|
||||
// MySQL will like us again.
|
||||
Nullable: true,
|
||||
DefaultIsEmpty: true,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return base.ModifyColumn(x, "user", &schemas.Column{
|
||||
Name: "salt",
|
||||
SQLType: schemas.SQLType{
|
||||
Name: "VARCHAR",
|
||||
},
|
||||
Length: 32,
|
||||
Nullable: true,
|
||||
DefaultIsEmpty: true,
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user