code.gitea.io/gitea@v1.21.7/models/migrations/v1_17/v215.go (about)

     1  // Copyright 2022 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_17 //nolint
     5  
     6  import (
     7  	"code.gitea.io/gitea/models/pull"
     8  	"code.gitea.io/gitea/modules/timeutil"
     9  
    10  	"xorm.io/xorm"
    11  )
    12  
    13  func AddReviewViewedFiles(x *xorm.Engine) error {
    14  	type ReviewState struct {
    15  		ID           int64                       `xorm:"pk autoincr"`
    16  		UserID       int64                       `xorm:"NOT NULL UNIQUE(pull_commit_user)"`
    17  		PullID       int64                       `xorm:"NOT NULL INDEX UNIQUE(pull_commit_user) DEFAULT 0"`
    18  		CommitSHA    string                      `xorm:"NOT NULL VARCHAR(40) UNIQUE(pull_commit_user)"`
    19  		UpdatedFiles map[string]pull.ViewedState `xorm:"NOT NULL LONGTEXT JSON"`
    20  		UpdatedUnix  timeutil.TimeStamp          `xorm:"updated"`
    21  	}
    22  
    23  	return x.Sync(new(ReviewState))
    24  }