You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

v205.go 852B

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