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
879 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. "xorm.io/xorm"
  7. "xorm.io/xorm/schemas"
  8. )
  9. func changeReviewContentToText(x *xorm.Engine) error {
  10. switch x.Dialect().URI().DBType {
  11. case schemas.MYSQL:
  12. _, err := x.Exec("ALTER TABLE review MODIFY COLUMN content TEXT")
  13. return err
  14. case schemas.ORACLE:
  15. _, err := x.Exec("ALTER TABLE review MODIFY content TEXT")
  16. return err
  17. case schemas.MSSQL:
  18. _, err := x.Exec("ALTER TABLE review ALTER COLUMN content TEXT")
  19. return err
  20. case schemas.POSTGRES:
  21. _, err := x.Exec("ALTER TABLE review ALTER COLUMN content TYPE TEXT")
  22. return err
  23. default:
  24. // SQLite doesn't support ALTER COLUMN, and it seem to already make String to _TEXT_ default so no migration needed
  25. return nil
  26. }
  27. }