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.

36 lines
803 B

  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. type UserV14 struct {
  21. DiffViewStyle string `xorm:"NOT NULL DEFAULT ''"`
  22. }
  23. func (*UserV14) TableName() string {
  24. return "user"
  25. }
  26. func createUserColumnDiffViewStyle(x *xorm.Engine) error {
  27. return x.Sync2(new(UserV14))
  28. }