NAME
Bigtop::ScriptHelp::Style::Original - handles ASCII art for scripts
SYNOPSIS
use Bigtop::ScriptHelp::Style;
my $style = Bigtop::ScriptHelp::Style->get_style( 'Original' );
# then pass $style to methods of Bigtop::ScriptHelp
DESCRIPTION
See Bigtop::ScriptHelp::Style
for a description of what this module must do in general.
METHODS
- get_db_layout
-
This method does not use standard in. Instead, it expects traditional ASCII art. See "ASCII Art" below.
ASCII Art
ASCII art allows you to quickly note relationships between tables with simple characters.
Note well: Since the relationships use punctuation that your shell probably loves, you must surround the art with single quotes.
It is easiest to understand the options by seeing an example. So, suppose we have a four table data model describing a bit of our personnel process:
+-----------+ +----------+
| job |<------| position |
+-----------+ +----------+
^
|
+-----------+ +----------+
| job_skill |------>| skill |
+-----------+ +----------+
First, you'll be happy to know that bigtop's ASCII art is simpler to draw than the above.
What our data model shows is that each position refers to a job (description), each job could require many skills, and each skill could be associated with many jobs. The last two mean that job and skill share a many-to-many relationship.
Here's how to specify this data model in bigtop ASCII art:
bigtop --new HR 'job<-position job<->skill'
This will indicate a foreign key from position to job and an implied table, called job_skill, to hold the many-to-many relationship between job and skill.
The same ASCII art can be used with --new and --add for both bigtop and tentmaker scripts.
There are four art operators:
- <->
-
Many-to-many. A new table will be made with foreign keys to each operand table. Each operand table will have a has_many relationship. Note that your Model backend may not understand these relationships. At the time of this writing only Model GantryDBIxClass did, by luck it happens to be the default.
- ->
-
The first table has a foreign key pointing to the second.
- <-
-
The second table has a foreign key pointing to the first. This is really a convenience synonymn for ->, but the tables are put into generated SQL in their overall order of appearance.
- -
-
The two tables have a one-to-one relationship. Each of them will have a foreign key pointing to the other.
AUTHOR
Phil Crow, <crow.phil@gmail.com>
COPYRIGHT AND LICENSE
Copyright (C) 2007, Phil Crow
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.