mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 06:24:11 +01:00 
			
		
		
		
	The xorm `Sync2` has already been deprecated in favor of `Sync`, so let's do the same inside the Gitea codebase. Command used to replace everything: ```sh for i in $(ag Sync2 --files-with-matches); do vim $i -c ':%sno/Sync2/Sync/g' -c ':wq'; done ```
		
			
				
	
	
		
			26 lines
		
	
	
		
			522 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			522 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2019 The Gitea Authors. All rights reserved.
 | 
						|
// SPDX-License-Identifier: MIT
 | 
						|
 | 
						|
package v1_10 //nolint
 | 
						|
 | 
						|
import "xorm.io/xorm"
 | 
						|
 | 
						|
func AddIndexOnRepositoryAndComment(x *xorm.Engine) error {
 | 
						|
	type Repository struct {
 | 
						|
		ID      int64 `xorm:"pk autoincr"`
 | 
						|
		OwnerID int64 `xorm:"index"`
 | 
						|
	}
 | 
						|
 | 
						|
	if err := x.Sync(new(Repository)); err != nil {
 | 
						|
		return err
 | 
						|
	}
 | 
						|
 | 
						|
	type Comment struct {
 | 
						|
		ID       int64 `xorm:"pk autoincr"`
 | 
						|
		Type     int   `xorm:"index"`
 | 
						|
		ReviewID int64 `xorm:"index"`
 | 
						|
	}
 | 
						|
 | 
						|
	return x.Sync(new(Comment))
 | 
						|
}
 |