From fe3f66f188a13dd0446f958928c3a3986d2d3411 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Sat, 27 Jun 2015 11:38:01 -0400 Subject: [PATCH] Producer/POD: add CHECK constraint support --- lib/SQL/Translator/Producer/POD.pm | 38 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/lib/SQL/Translator/Producer/POD.pm b/lib/SQL/Translator/Producer/POD.pm index abced9833..76c795a5a 100644 --- a/lib/SQL/Translator/Producer/POD.pm +++ b/lib/SQL/Translator/Producer/POD.pm @@ -83,23 +83,27 @@ sub produce { $pod .= "=head3 CONSTRAINTS\n\n"; for my $c ( @constraints ) { $pod .= "=head4 " . $c->type . "\n\n=over 4\n\n"; - $pod .= "=item * Fields = " . - join(', ', $c->fields ) . "\n\n"; - - if ( $c->type eq FOREIGN_KEY ) { - $pod .= "=item * Reference Table = Lreference_table . ">\n\n"; - $pod .= "=item * Reference Fields = " . - join(', ', map {"L"} $c->reference_fields ) . - "\n\n"; - } - - if ( my $update = $c->on_update ) { - $pod .= "=item * On update = $update\n\n"; - } - - if ( my $delete = $c->on_delete ) { - $pod .= "=item * On delete = $delete\n\n"; + if($c->type eq 'CHECK') { + $pod .= "=item * Expression = " . $c->expression . "\n\n"; + } else { + $pod .= "=item * Fields = " . + join(', ', $c->fields ) . "\n\n"; + + if ( $c->type eq FOREIGN_KEY ) { + $pod .= "=item * Reference Table = Lreference_table . ">\n\n"; + $pod .= "=item * Reference Fields = " . + join(', ', map {"L"} $c->reference_fields ) . + "\n\n"; + } + + if ( my $update = $c->on_update ) { + $pod .= "=item * On update = $update\n\n"; + } + + if ( my $delete = $c->on_delete ) { + $pod .= "=item * On delete = $delete\n\n"; + } } $pod .= "=back\n\n";