mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 06:21:11 +00:00 
			
		
		
		
	Migration code: errors are not to be forgotten
This commit is contained in:
		
					parent
					
						
							
								2a70d6b723
							
						
					
				
			
			
				commit
				
					
						4ef3245413
					
				
			
		
					 1 changed files with 6 additions and 2 deletions
				
			
		|  | @ -20,7 +20,9 @@ var migrations = []migration{} | ||||||
| 
 | 
 | ||||||
| // Migrate database to current version | // Migrate database to current version | ||||||
| func Migrate(x *xorm.Engine) error { | func Migrate(x *xorm.Engine) error { | ||||||
| 	x.Sync(new(Version)) | 	if err := x.Sync(new(Version)); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	currentVersion := &Version{Id: 1} | 	currentVersion := &Version{Id: 1} | ||||||
| 	has, err := x.Get(currentVersion) | 	has, err := x.Get(currentVersion) | ||||||
|  | @ -39,7 +41,9 @@ func Migrate(x *xorm.Engine) error { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
| 		currentVersion.Version = v + int64(i) + 1 | 		currentVersion.Version = v + int64(i) + 1 | ||||||
| 		x.Id(1).Update(currentVersion) | 		if _, err = x.Id(1).Update(currentVersion); err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue