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.

31 lines
787 B

  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package migrations
  5. import (
  6. "fmt"
  7. "xorm.io/xorm"
  8. "xorm.io/xorm/schemas"
  9. )
  10. func changeU2FCounterType(x *xorm.Engine) error {
  11. var err error
  12. switch x.Dialect().URI().DBType {
  13. case schemas.MYSQL:
  14. _, err = x.Exec("ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT")
  15. case schemas.POSTGRES:
  16. _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` SET DATA TYPE bigint")
  17. case schemas.MSSQL:
  18. _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` BIGINT")
  19. }
  20. if err != nil {
  21. return fmt.Errorf("Error changing u2f_registration counter column type: %v", err)
  22. }
  23. return nil
  24. }