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.

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