code.gitea.io/gitea@v1.21.7/models/migrations/v1_8/v81.go (about) 1 // Copyright 2019 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package v1_8 //nolint 5 6 import ( 7 "fmt" 8 9 "xorm.io/xorm" 10 "xorm.io/xorm/schemas" 11 ) 12 13 func ChangeU2FCounterType(x *xorm.Engine) error { 14 var err error 15 16 switch x.Dialect().URI().DBType { 17 case schemas.MYSQL: 18 _, err = x.Exec("ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT") 19 case schemas.POSTGRES: 20 _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` SET DATA TYPE bigint") 21 case schemas.MSSQL: 22 _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` BIGINT") 23 } 24 25 if err != nil { 26 return fmt.Errorf("Error changing u2f_registration counter column type: %w", err) 27 } 28 29 return nil 30 }