Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rabestro/sap-cds-erd

AWK script to create a ER diagram for SAP Cloud Application Programming Model
https://github.com/rabestro/sap-cds-erd

cds entity-relationship-diagram erdiagram mermaid-diagrams plantuml sap sap-cloud-platform script

Last synced: about 2 months ago
JSON representation

AWK script to create a ER diagram for SAP Cloud Application Programming Model

Awesome Lists containing this project

README

        

= SAP CDS Entity Relationship Diagrams
:hide-uri-scheme:

The small AWK script generate https://mermaid.js.org/[mermaid] Entity Relationship diagrams from SAP Cloud Application Programming Model files.

== How to run script

[source,shell]
----
gawk -f src/cds2erd.awk db/* > bookstore.mermaid
----

Alternatively, you can move the script to the bin directory and make it executable:

[source,shell]
----
chmod +x cds2erd.awk
----

In this case you can call the script without specifying an interpreter:

[source,shell]
----
cds2erd.awk schema.cds > schema.mermaid
----

== Sample generated ER diagram

Below is the database schema from the project https://github.com/SAP-samples/cloud-cap-samples/[SAP Cloud CAP Samples Bookstore]

[source,mermaid]
----
erDiagram
Books {
String title
String descr
Integer stock
Decimal price
Currency currency
Decimal rating
TechnicalBooleanFlag isReviewable
}

Authors {
String name
Date dateOfBirth
Date dateOfDeath
String placeOfBirth
String placeOfDeath
}

Genres {
String name
String descr
Integer ID PK
}

Notes {
String note
}

Orders {
String OrderNo
User buyer
Decimal total
Currency currency
}

OrderItems {
Integer quantity
Decimal amount
}

Reviews {
Rating rating
String title
String text
}

Orders |o--o{ OrderItems : ""
OrderItems |o--o| Books : ""
Genres }o--o| Genres : ""
Books |o--o{ Reviews : ""
Books |o--o| Genres : ""
Books }o--o| Authors : ""

----