mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-11-04 08:42:24 -06:00 
			
		
		
		
	[bugfix] Fix length for type varchar must be at least 1 on Postgres
		
	This commit is contained in:
		
					parent
					
						
							
								98c4cae89a
							
						
					
				
			
			
				commit
				
					
						d7cbe19b65
					
				
			
		
					 1 changed files with 8 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -253,9 +253,14 @@ func getBunColumnDef(db bun.IDB, rtype reflect.Type, fieldName string) (string,
 | 
			
		|||
		} else {
 | 
			
		||||
			buf = append(buf, sqltype.VarChar...)
 | 
			
		||||
		}
 | 
			
		||||
		buf = append(buf, "("...)
 | 
			
		||||
		buf = strconv.AppendInt(buf, int64(d.DefaultVarcharLen()), 10)
 | 
			
		||||
		buf = append(buf, ")"...)
 | 
			
		||||
 | 
			
		||||
		// Only specify varchar length for dialects
 | 
			
		||||
		// where specifying VARCHAR length is mandatory.
 | 
			
		||||
		if dvl := d.DefaultVarcharLen(); dvl != 0 {
 | 
			
		||||
			buf = append(buf, "("...)
 | 
			
		||||
			buf = strconv.AppendInt(buf, int64(dvl), 10)
 | 
			
		||||
			buf = append(buf, ")"...)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Append not null definition if field requires.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue