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.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2020 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. "code.gitea.io/gitea/modules/timeutil"
  7. "xorm.io/xorm"
  8. )
  9. func addTimeStamps(x *xorm.Engine) error {
  10. // this will add timestamps where it is useful to have
  11. // Star represents a starred repo by an user.
  12. type Star struct {
  13. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  14. }
  15. if err := x.Sync2(new(Star)); err != nil {
  16. return err
  17. }
  18. // Label represents a label of repository for issues.
  19. type Label struct {
  20. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  21. UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
  22. }
  23. if err := x.Sync2(new(Label)); err != nil {
  24. return err
  25. }
  26. // Follow represents relations of user and his/her followers.
  27. type Follow struct {
  28. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  29. }
  30. if err := x.Sync2(new(Follow)); err != nil {
  31. return err
  32. }
  33. // Watch is connection request for receiving repository notification.
  34. type Watch struct {
  35. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  36. UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
  37. }
  38. if err := x.Sync2(new(Watch)); err != nil {
  39. return err
  40. }
  41. // Collaboration represent the relation between an individual and a repository.
  42. type Collaboration struct {
  43. CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
  44. UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
  45. }
  46. return x.Sync2(new(Collaboration))
  47. }