mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-15 14:08:21 +00:00
12c742f8dc
Upgrade builder to v0.3.11 Upgrade xorm to v1.3.1 and fixed some hidden bugs. Replace #19821 Replace #19834 Included #19850 Co-authored-by: zeripath <art27@cantab.net>
42 lines
863 B
Go
42 lines
863 B
Go
// 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 migrations
|
|
|
|
import (
|
|
"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 := 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 modifyColumn(x, "user", &schemas.Column{
|
|
Name: "salt",
|
|
SQLType: schemas.SQLType{
|
|
Name: "VARCHAR",
|
|
},
|
|
Length: 32,
|
|
Nullable: true,
|
|
DefaultIsEmpty: true,
|
|
})
|
|
}
|