Browse files

fixed: DEFAULT constraint names not escaped.

  • Loading branch information...
1 parent 021af65 commit ccd300c76ce677864ab627b3a33237d1d872e963 @Pathoschild committed Dec 6, 2012
View
2 src/FluentMigrator.Runner/Generators/SqlServer/SqlServer2000Generator.cs
@@ -138,7 +138,7 @@ public override string Generate(AlterDefaultConstraintExpression expression)
Quoter.QuoteTableName(expression.TableName),
Quoter.QuoteColumnName(expression.ColumnName),
Quoter.QuoteValue(expression.DefaultValue),
- SqlServerColumn.GetDefaultConstraintName(expression.TableName, expression.ColumnName)));
+ Quoter.QuoteConstraintName(SqlServerColumn.GetDefaultConstraintName(expression.TableName, expression.ColumnName))));
return builder.ToString();
}
View
2 src/FluentMigrator.Runner/Generators/SqlServer/SqlServer2005Generator.cs
@@ -273,7 +273,7 @@ public override string Generate(AlterDefaultConstraintExpression expression)
Quoter.QuoteColumnName(expression.ColumnName),
Quoter.QuoteValue(expression.DefaultValue),
Quoter.QuoteSchemaName(expression.SchemaName),
- SqlServerColumn.GetDefaultConstraintName(expression.TableName, expression.ColumnName)));
+ Quoter.QuoteConstraintName(SqlServerColumn.GetDefaultConstraintName(expression.TableName, expression.ColumnName))));
return builder.ToString();
}
View
2 src/FluentMigrator.Runner/Generators/SqlServer/SqlServerColumn.cs
@@ -19,7 +19,7 @@ protected override string FormatDefaultValue(ColumnDefinition column)
var defaultValue = base.FormatDefaultValue(column);
if (column.ModificationType == ColumnModificationType.Create && !string.IsNullOrEmpty(defaultValue))
- return "CONSTRAINT " + GetDefaultConstraintName(column.TableName, column.Name) + " " + defaultValue;
+ return "CONSTRAINT " + Quoter.QuoteConstraintName(GetDefaultConstraintName(column.TableName, column.Name)) + " " + defaultValue;
return string.Empty;
}

0 comments on commit ccd300c

Please sign in to comment.