Skip to content

Commit

Permalink
Merge pull request #32 from tristangrebot/master
Browse files Browse the repository at this point in the history
Fix missing headercolor setting in Table dbml generation
  • Loading branch information
Vanderhoof authored Mar 15, 2024
2 parents 860f71f + 71d63f5 commit 952fd07
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pydbml/classes/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ def dbml(self):
result += f'Table {name} '
if self.alias:
result += f'as "{self.alias}" '
if self.header_color:
result += f'[headercolor: {self.header_color}] '
result += '{\n'
columns_str = '\n'.join(c.dbml for c in self.columns)
result += indent(columns_str) + '\n'
Expand Down
18 changes: 18 additions & 0 deletions test/test_classes/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,24 @@ def test_dbml_simple(self):
}'''
self.assertEqual(t.dbml, expected)

def test_header_color_dbml(self):
t = Table('products')
t.header_color = '#C84432'
c1 = Column('id', 'integer')
c2 = Column('name', 'varchar2')
t.add_column(c1)
t.add_column(c2)
s = Database()
s.add(t)

expected = \
'''Table "products" [headercolor: #C84432] {
"id" integer
"name" varchar2
}'''
self.assertEqual(t.dbml, expected)


def test_schema_dbml(self):
t = Table('products', schema="myschema")
c1 = Column('id', 'integer')
Expand Down

0 comments on commit 952fd07

Please sign in to comment.