diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-03-22 23:12:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-22 11:12:55 -0400 |
commit | c61b902538e8e4b2bb83136f190e044a6bbcdd9b (patch) | |
tree | bc08142f5ced69721ab14793b8dc62aa83314268 /models/migrations/v110.go | |
parent | dcaa5643d70cd1be72e53e82a30d2bc6e5f8de92 (diff) | |
download | gitea-c61b902538e8e4b2bb83136f190e044a6bbcdd9b.tar.gz gitea-c61b902538e8e4b2bb83136f190e044a6bbcdd9b.zip |
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
Diffstat (limited to 'models/migrations/v110.go')
-rw-r--r-- | models/migrations/v110.go | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/models/migrations/v110.go b/models/migrations/v110.go index dc46c2ef77..4a1c3c47a7 100644 --- a/models/migrations/v110.go +++ b/models/migrations/v110.go @@ -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 } |