Fork to maintain patches against the official gitea for https://code.ceondo.com https://github.com/go-gitea/gitea

v14.go 936B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2016 The Gogs 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. "fmt"
  7. "github.com/go-xorm/xorm"
  8. )
  9. func setCommentUpdatedWithCreated(x *xorm.Engine) (err error) {
  10. type Comment struct {
  11. UpdatedUnix int64
  12. }
  13. if err = x.Sync2(new(Comment)); err != nil {
  14. return fmt.Errorf("Sync2: %v", err)
  15. } else if _, err = x.Exec("UPDATE comment SET updated_unix = created_unix"); err != nil {
  16. return fmt.Errorf("set update_unix: %v", err)
  17. }
  18. return nil
  19. }
  20. // UserV14 describes the added fields for migrating from v13 -> v14
  21. type UserV14 struct {
  22. DiffViewStyle string `xorm:"NOT NULL DEFAULT ''"`
  23. }
  24. // TableName will be invoked by XORM to customize the table name
  25. func (*UserV14) TableName() string {
  26. return "user"
  27. }
  28. func createUserColumnDiffViewStyle(x *xorm.Engine) error {
  29. return x.Sync2(new(UserV14))
  30. }