code.gitea.io/gitea@v1.21.7/models/migrations/v1_10/v91.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_10 //nolint
     5  
     6  import "xorm.io/xorm"
     7  
     8  func AddIndexOnRepositoryAndComment(x *xorm.Engine) error {
     9  	type Repository struct {
    10  		ID      int64 `xorm:"pk autoincr"`
    11  		OwnerID int64 `xorm:"index"`
    12  	}
    13  
    14  	if err := x.Sync(new(Repository)); err != nil {
    15  		return err
    16  	}
    17  
    18  	type Comment struct {
    19  		ID       int64 `xorm:"pk autoincr"`
    20  		Type     int   `xorm:"index"`
    21  		ReviewID int64 `xorm:"index"`
    22  	}
    23  
    24  	return x.Sync(new(Comment))
    25  }