mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Doctor check & fix db consistency (#11111)
needed to fix issue as described in #10280 * rename check-db to check-db-version * add check-db-consistency: * find issues without existing repository * find pulls without existing issues * find tracked times without existing issues/pulls * find labels without repository or org reference Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -182,6 +182,10 @@ func SetEngine() (err error) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewEngine initializes a new xorm.Engine
 | 
			
		||||
// This function must never call .Sync2() if the provided migration function fails.
 | 
			
		||||
// When called from the "doctor" command, the migration function is a version check
 | 
			
		||||
// that prevents the doctor from fixing anything in the database if the migration level
 | 
			
		||||
// is different from the expected value.
 | 
			
		||||
func NewEngine(ctx context.Context, migrateFunc func(*xorm.Engine) error) (err error) {
 | 
			
		||||
	if err = SetEngine(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user