forked from forgejo/forgejo
Upgrade xorm to v1.0.0 (#10646)
* Upgrade xorm to v1.0.0 * small nit * Fix tests * Update xorm * Update xorm * fix go.sum * fix test * Fix bug when dump * Fix bug * update xorm to latest * Fix migration test * update xorm to latest * Fix import order * Use xorm tag
This commit is contained in:
parent
dcaa5643d7
commit
c61b902538
154 changed files with 7195 additions and 5962 deletions
|
@ -5,32 +5,26 @@
|
|||
package migrations
|
||||
|
||||
import (
|
||||
"xorm.io/core"
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
func changeReviewContentToText(x *xorm.Engine) error {
|
||||
|
||||
if x.Dialect().DBType() == core.MYSQL {
|
||||
switch x.Dialect().URI().DBType {
|
||||
case schemas.MYSQL:
|
||||
_, err := x.Exec("ALTER TABLE review MODIFY COLUMN content TEXT")
|
||||
return err
|
||||
}
|
||||
|
||||
if x.Dialect().DBType() == core.ORACLE {
|
||||
case schemas.ORACLE:
|
||||
_, err := x.Exec("ALTER TABLE review MODIFY content TEXT")
|
||||
return err
|
||||
}
|
||||
|
||||
if x.Dialect().DBType() == core.MSSQL {
|
||||
case schemas.MSSQL:
|
||||
_, err := x.Exec("ALTER TABLE review ALTER COLUMN content TEXT")
|
||||
return err
|
||||
}
|
||||
|
||||
if x.Dialect().DBType() == core.POSTGRES {
|
||||
case schemas.POSTGRES:
|
||||
_, err := x.Exec("ALTER TABLE review ALTER COLUMN content TYPE TEXT")
|
||||
return err
|
||||
default:
|
||||
// SQLite doesn't support ALTER COLUMN, and it seem to already make String to _TEXT_ default so no migration needed
|
||||
return nil
|
||||
}
|
||||
|
||||
// SQLite doesn't support ALTER COLUMN, and it seem to already make String to _TEXT_ default so no migration needed
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -8,17 +8,18 @@ import (
|
|||
"fmt"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
func changeU2FCounterType(x *xorm.Engine) error {
|
||||
var err error
|
||||
|
||||
switch x.Dialect().DriverName() {
|
||||
case "mysql":
|
||||
switch x.Dialect().URI().DBType {
|
||||
case schemas.MYSQL:
|
||||
_, err = x.Exec("ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT")
|
||||
case "postgres":
|
||||
case schemas.POSTGRES:
|
||||
_, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` SET DATA TYPE bigint")
|
||||
case "mssql":
|
||||
case schemas.MSSQL:
|
||||
_, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` BIGINT")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue