Skip to content

Commit

Permalink
Adding comments to options instead of column_str, fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
justinellison committed Mar 20, 2024
1 parent a1340dc commit b68ec30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion paracelsus/transformers/mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _column(self, column: Column) -> str:
column_str += " UK"

if column.comment:
column_str += f' "{column.comment}"'
options.append(f"{column.comment}")

if column.nullable:
options.append("nullable")
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Post(Base):
id = mapped_column(Uuid, primary_key=True, default=uuid4())
author = mapped_column(ForeignKey(User.id), nullable=False)
created = mapped_column(DateTime, nullable=False, default=datetime.utcnow())
live = mapped_column(Boolean, default=False)
live = mapped_column(Boolean, default=False, comment="True if post is published")
content = mapped_column(Text, default="")

class Comment(Base):
Expand Down
4 changes: 3 additions & 1 deletion tests/transformers/test_mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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 @@ -14,5 +15,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 "nullable"' in graph_string
assert 'CHAR(32) post FK "Foreign key references comments,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 b68ec30

Please sign in to comment.