Skip to content

Commit

Permalink
Implementing requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
justinellison committed Mar 20, 2024
1 parent b68ec30 commit 41b3a19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions paracelsus/transformers/mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ def _column(self, column: Column) -> str:
column_str += " PK"
elif len(column.foreign_keys) > 0:
column_str += " FK"
options.append(f"Foreign key references {column.table.name}")
elif column.unique:
column_str += " UK"

if column.comment:
options.append(f"{column.comment}")
options.append(column.comment)

if column.nullable:
options.append("nullable")
Expand Down
3 changes: 1 addition & 2 deletions tests/transformers/test_mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
def test_mermaid(metaclass):
mermaid = Mermaid(metaclass=metaclass)
graph_string = str(mermaid)
print(graph_string)

assert "users {" in graph_string
assert "posts {" in graph_string
Expand All @@ -15,6 +14,6 @@ def test_mermaid(metaclass):
assert "users ||--o{ comments : author" in graph_string

assert "CHAR(32) author FK" in graph_string
assert 'CHAR(32) post FK "Foreign key references comments,nullable"' in graph_string
assert 'CHAR(32) post FK "nullable"' in graph_string
assert 'BOOLEAN live "True if post is published,nullable"' in graph_string
assert "DATETIME created" in graph_string

0 comments on commit 41b3a19

Please sign in to comment.