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.

v154.go 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package v1_13 //nolint
  4. import (
  5. "code.gitea.io/gitea/modules/timeutil"
  6. "xorm.io/xorm"
  7. )
  8. func AddTimeStamps(x *xorm.Engine) error {
  9. // this will add timestamps where it is useful to have
  10. // Star represents a starred repo by an user.
  11. type Star struct {
  12. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  13. }
  14. if err := x.Sync2(new(Star)); err != nil {
  15. return err
  16. }
  17. // Label represents a label of repository for issues.
  18. type Label struct {
  19. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  20. UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
  21. }
  22. if err := x.Sync2(new(Label)); err != nil {
  23. return err
  24. }
  25. // Follow represents relations of user and their followers.
  26. type Follow struct {
  27. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  28. }
  29. if err := x.Sync2(new(Follow)); err != nil {
  30. return err
  31. }
  32. // Watch is connection request for receiving repository notification.
  33. type Watch struct {
  34. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  35. UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
  36. }
  37. if err := x.Sync2(new(Watch)); err != nil {
  38. return err
  39. }
  40. // Collaboration represent the relation between an individual and a repository.
  41. type Collaboration struct {
  42. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  43. UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
  44. }
  45. return x.Sync2(new(Collaboration))
  46. }