mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-03 18:02:28 +02: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:
parent
4827f42f56
commit
e72acd5e5b
190 changed files with 1711 additions and 1481 deletions
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,
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue