Update migrator.go
fix bug: 字符串默认值未使用引号包裹导致sql格式非法
This commit is contained in:
		
							parent
							
								
									7cf0819f93
								
							
						
					
					
						commit
						19a96b5c11
					
				@ -87,7 +87,7 @@ func (m Migrator) FullDataTypeOf(field *schema.Field) (expr clause.Expr) {
 | 
				
			|||||||
			m.Dialector.BindVarTo(defaultStmt, defaultStmt, field.DefaultValueInterface)
 | 
								m.Dialector.BindVarTo(defaultStmt, defaultStmt, field.DefaultValueInterface)
 | 
				
			||||||
			expr.SQL += " DEFAULT " + m.Dialector.Explain(defaultStmt.SQL.String(), field.DefaultValueInterface)
 | 
								expr.SQL += " DEFAULT " + m.Dialector.Explain(defaultStmt.SQL.String(), field.DefaultValueInterface)
 | 
				
			||||||
		} else if field.DefaultValue != "(-)" {
 | 
							} else if field.DefaultValue != "(-)" {
 | 
				
			||||||
			expr.SQL += " DEFAULT " + field.DefaultValue
 | 
								expr.SQL += ` DEFAULT "` + field.DefaultValue +`"`
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user