Skip to content

Instantly share code, notes, and snippets.

@gaardhus
Created February 7, 2024 15:08
Show Gist options
  • Save gaardhus/9692a25cc8a1cf10017850c7751f096b to your computer and use it in GitHub Desktop.
Save gaardhus/9692a25cc8a1cf10017850c7751f096b to your computer and use it in GitHub Desktop.
Create an ERD from a sqlite database using schemaspy
db-name=database
path-to-db=./data
db-ext=sqlite
output-directory=./docs/diagrams
output-file=diagram.png
db-diagram:
schemaspy -dp /usr/share/java/sqlite-jdbc/ \
-t sqlite-xerial \
-cat ${db-name} -s ${db-name} -db ${path-to-db}/${db-name}.${db-ext} \
-sso -o /tmp/schemaspy/ && \
mkdir --parents $(output-directory); mv /tmp/schemaspy/diagrams/summary/relationships.real.large.png ${output-directory}/${output-file}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment