Skip to content

Commit

Permalink
Update details in Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sualeh committed May 4, 2023
1 parent a58c70b commit b6391df
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ Contact details for book authors
- IDX_B_AUTHORS (LASTNAME, FIRSTNAME)
- IDX_A_AUTHORS (CITY, STATE, POSTALCODE, COUNTRY)

### Foreign Keys
- PUBLIC.BOOKS.AUTHORS --> PUBLIC.BOOKS.BOOKAUTHORS



### BOOKS (table)
Expand Down Expand Up @@ -55,9 +52,7 @@ Current price for the book
- FK_PREVIOUSEDITION (PREVIOUSEDITIONID)

### Foreign Keys
- PUBLIC.BOOKS.BOOKS --> PUBLIC.BOOKS.BOOKAUTHORS
- PUBLIC.BOOKS.BOOKS --> PUBLIC.BOOKS.BOOKS
- PUBLIC.BOOKS.BOOKS --> PUBLIC."PUBLISHER SALES".SALES
- FK_PREVIOUSEDITION (*PREVIOUSEDITIONID* --> **BOOKS.ID**)



Expand All @@ -72,9 +67,6 @@ Current price for the book

### Indexes

### Foreign Keys
- PUBLIC.BOOKS."Celebrities" --> PUBLIC.BOOKS."Celebrity Updates"



### COUPONS (table)
Expand Down Expand Up @@ -134,9 +126,6 @@ Name of book publisher

### Indexes

### Foreign Keys
- PUBLIC.BOOKS.PUBLISHERS --> PUBLIC.BOOKS.ΒΙΒΛΊΑ



### BOOKAUTHORS (table)
Expand All @@ -153,6 +142,10 @@ along with the latest updated information
- SYS_FK_10120 (BOOKID)
- UIDX_BOOKAUTHORS (BOOKID, AUTHORID) (unique index)

### Foreign Keys
- Z_FK_AUTHOR (*AUTHORID* --> **AUTHORS.ID**)
- SYS_FK_10120 (*BOOKID* --> **BOOKS.ID**)



### Celebrity Updates (table)
Expand All @@ -166,6 +159,9 @@ along with the latest updated information

### Indexes

### Foreign Keys
- SYS_FK_10130 (*Celebrity Id* --> **"Celebrities"."Id"**)



### ΒΙΒΛΊΑ (table)
Expand All @@ -182,6 +178,9 @@ along with the latest updated information
### Indexes
- FK_ΒΙΒΛΊΑ_PUBLISHERS (ΕΚΔΌΤΗΣ)

### Foreign Keys
- FK_ΒΙΒΛΊΑ_PUBLISHERS (*ΕΚΔΌΤΗΣ* --> **PUBLISHERS.ID**)



### AUTHORSLIST (view)
Expand All @@ -208,9 +207,6 @@ along with the latest updated information

### Indexes

### Foreign Keys
- PUBLIC."PUBLISHER SALES".REGIONS --> PUBLIC."PUBLISHER SALES".SALES



### SALESDATA (table)
Expand All @@ -222,9 +218,6 @@ along with the latest updated information
### Indexes
- UQ_CUSTOMERS (SALESDATAID) (unique index)

### Foreign Keys
- PUBLIC."PUBLISHER SALES".SALESDATA --> PUBLIC."PUBLISHER SALES".SALES



### SALES (table)
Expand All @@ -243,5 +236,11 @@ along with the latest updated information
- FK_SALES_SALESDATA (SALESDATAID)
- FK_SALES_REGIONS (POSTALCODE, COUNTRY)

### Foreign Keys
- FK_SALES_BOOK (*BOOKID* --> **BOOKS.ID**)
- FK_SALES_SALESDATA (*SALESDATAID* --> **SALESDATA.SALESDATAID**)
- FK_SALES_REGIONS (*POSTALCODE* --> **REGIONS.POSTALCODE**)
- FK_SALES_REGIONS (*COUNTRY* --> **REGIONS.COUNTRY**)



21 changes: 16 additions & 5 deletions schemacrawler-scripting/src/test/resources/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@
print('- ' + primaryKey.name + ' ('
+ MetaDataUtility.getColumnsListAsString(primaryKey, identifiers) + ') ')

if not table.indexes.isEmpty():
indexes = table.indexes
if not indexes.isEmpty():
print('')
print('### Indexes')
for index in table.indexes:
for index in indexes:
if table.hasPrimaryKey() and \
MetaDataUtility.getColumnsListAsString(table.primaryKey, identifiers) == \
MetaDataUtility.getColumnsListAsString(index, identifiers):
Expand All @@ -84,11 +85,21 @@
print(' (unique index)', end='')
print('')

if not table.referencingTables.isEmpty():
foreign_keys = table.importedForeignKeys
if not foreign_keys.isEmpty():
print('')
print('### Foreign Keys')
for childTable in table.referencingTables:
print('- ' + table.fullName + ' --> ' + childTable.fullName)
for fk in foreign_keys:
pkTable = fk.primaryKeyTable
fkTable = fk.foreignKeyTable
for columnReference in fk.columnReferences:
print('- ', end='')
if fk.name and not fk.name.startswith('SCHCRWLR_'):
print(fk.name, end='')
pkColumn = columnReference.primaryKeyColumn
fkColumn = columnReference.foreignKeyColumn
print(' (*' + fkColumn.name + '* --> **' + pkColumn.shortName + "**)", end='')
print('')

print('')
print('')
Expand Down

0 comments on commit b6391df

Please sign in to comment.