gitea源码

1234567891011121314151617181920212223242526272829
  1. // Copyright 2025 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package v1_25
  4. import (
  5. "code.gitea.io/gitea/models/migrations/base"
  6. "xorm.io/xorm"
  7. "xorm.io/xorm/schemas"
  8. )
  9. func ExtendCommentTreePathLength(x *xorm.Engine) error {
  10. dbType := x.Dialect().URI().DBType
  11. if dbType == schemas.SQLITE { // For SQLITE, varchar or char will always be represented as TEXT
  12. return nil
  13. }
  14. return base.ModifyColumn(x, "comment", &schemas.Column{
  15. Name: "tree_path",
  16. SQLType: schemas.SQLType{
  17. Name: "VARCHAR",
  18. },
  19. Length: 4000,
  20. Nullable: true, // To keep compatible as nullable
  21. DefaultIsEmpty: true,
  22. })
  23. }