code.gitea.io/gitea@v1.21.7/models/migrations/v1_16/v205.go (about) 1 // Copyright 2022 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package v1_16 //nolint 5 6 import ( 7 "code.gitea.io/gitea/models/migrations/base" 8 9 "xorm.io/xorm" 10 "xorm.io/xorm/schemas" 11 ) 12 13 func MigrateUserPasswordSalt(x *xorm.Engine) error { 14 dbType := x.Dialect().URI().DBType 15 // For SQLITE, the max length doesn't matter. 16 if dbType == schemas.SQLITE { 17 return nil 18 } 19 20 if err := base.ModifyColumn(x, "user", &schemas.Column{ 21 Name: "rands", 22 SQLType: schemas.SQLType{ 23 Name: "VARCHAR", 24 }, 25 Length: 32, 26 // MySQL will like us again. 27 Nullable: true, 28 DefaultIsEmpty: true, 29 }); err != nil { 30 return err 31 } 32 33 return base.ModifyColumn(x, "user", &schemas.Column{ 34 Name: "salt", 35 SQLType: schemas.SQLType{ 36 Name: "VARCHAR", 37 }, 38 Length: 32, 39 Nullable: true, 40 DefaultIsEmpty: true, 41 }) 42 }