SQLT-DIAGRAM(1)

🌸 NAME 🌸

sqlt-diagram β€” aka SQLT-DIAGRAM(1), from the User Contributed Perl Documentation corner β€” automatically creates a diagram from a database schema. Iconic behavior, honestly πŸ’….


✨ SYNOPSIS ✨

./sqlt-diagram -d|-f|--from|--db=db_parser [options] schema.sql

The options, bestie ✨

  • -o|--output β€” Output file name (default STDOUT)
  • -i|--image β€” Output image type ("png" or "jpeg," default "png") β€” yes, the comma is living inside the quotes in the original, I’m not touching it 🫢
  • -t|--title β€” Title to give the schema
  • -c|--cols β€” Number of columns
  • -n|--no-lines β€” Don’t draw lines
  • --font-size β€” Font size ("small," "medium," "large," or "huge," default "medium")
  • --gutter β€” Gutter size between tables
  • --color β€” Add colors
  • --show-fk-only β€” Only show fields that act as primary or foreign keys
  • --natural-join β€” Perform natural joins
  • --natural-join-pk β€” Perform natural joins from primary keys only
  • -s|--skip β€” Fields to skip in natural joins
  • --skip-tables β€” Comma-separated list of table names to exclude
  • --skip-tables-like β€” Comma-separated list of regexen to exclude tables
  • --debug β€” Print debugging information

πŸ¦‹ DESCRIPTION πŸ¦‹

This script will create a picture of your schema. Only the database driver argument (for SQL::Translator) is required. If no output file name is given, then the image will be printed to STDOUT, so you should redirect the output into a file. Very β€œtrust the process” of it all πŸ’–.

The default action is to assume the presence of foreign key relationships defined via REFERENCES or FOREIGN KEY constraints on the tables. If you are parsing the schema of a file that does not have these, you will find the natural join options helpful. With natural joins, like-named fields will be considered foreign keys.

This can prove too permissive, however, as you probably don’t want a field called name to be considered a foreign key 😭.

So you could include it in the skip option, and all fields called name will be excluded from natural joins. A more efficient method, however, might be to simply deduce the foreign keys from primary keys to other fields named the same in other tables. Use the natural-join-pk option to achieve this. Slay πŸ’….


πŸ‘‘ AUTHOR πŸ‘‘

Ken Youens-Clark <kclark@cpan.org>.


Made with perl v5.42.0, dated 2024-12-12 β€” that’s the source/version and date, bestie, and that’s the whole manual page era πŸ’œβœ¨

πŸ“¦ where this page comes from