Skip to content

Commit

Permalink
Fix quirky column names
Browse files Browse the repository at this point in the history
fixes #2108
  • Loading branch information
ErikEJ committed Jan 21, 2024
1 parent 10d66b8 commit 7f18b6a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Core/RevEng.Core.60/Mermaid/DatabaseModelToMermaid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public string CreateMermaid()
sb.AppendLine(CultureInfo.InvariantCulture, $" {formattedTableName} {{");
foreach (var column in table.Columns)
{
var formattedColumnName = column.Name.Replace(" ", string.Empty, System.StringComparison.OrdinalIgnoreCase);

var pkfk = string.Empty;

if (table.PrimaryKey?.Columns.Contains(column) ?? false)
Expand All @@ -48,7 +50,7 @@ public string CreateMermaid()
}

var nullable = column.IsNullable ? "(NULL)" : string.Empty;
sb.AppendLine(CultureInfo.InvariantCulture, $" {column.Name} {column.StoreType?.Replace(", ", "-", System.StringComparison.OrdinalIgnoreCase)}{nullable} {pkfk}");
sb.AppendLine(CultureInfo.InvariantCulture, $" {formattedColumnName} {column.StoreType?.Replace(", ", "-", System.StringComparison.OrdinalIgnoreCase)}{nullable} {pkfk}");
}

sb.AppendLine(" }");
Expand Down

0 comments on commit 7f18b6a

Please sign in to comment.