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.

v81.go 784B

1234567891011121314151617181920212223242526272829303132
  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. "github.com/go-xorm/xorm"
  8. )
  9. func changeU2FCounterType(x *xorm.Engine) error {
  10. var err error
  11. switch x.Dialect().DriverName() {
  12. case "tidb":
  13. fallthrough
  14. case "mysql":
  15. _, err = x.Exec("ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT")
  16. case "postgres":
  17. _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` SET DATA TYPE bigint")
  18. case "mssql":
  19. _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` BIGINT")
  20. }
  21. if err != nil {
  22. return fmt.Errorf("Error changing u2f_registration counter column type: %v", err)
  23. }
  24. return nil
  25. }