From: Andrew Gregory Date: Sat, 27 Jun 2015 15:38:01 +0000 (-0400) Subject: Add support for CHECK constraint in POD producer (GH#63) X-Git-Tag: v0.11022~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=59d5eaf632f52bf21569c05b1f63dd9829e26bc7;p=dbsrgits%2FSQL-Translator.git Add support for CHECK constraint in POD producer (GH#63) --- diff --git a/Changes b/Changes index deb821d..4198719 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ Changes for SQL::Translator * Add support for monotonically increasing SQLite autoincs (GH#47) * Add support for CHECK constraint in SQLite producer (GH#57) + * Add support for CHECK constraint in POD producer (GH#63) * Fix forgotten quoting in the MySQL DROP TABLE diff producer (GH#50) * Fix Pg grammar parsing of UUID, time, timetz columns (RT#100196, GH#52) * Add support for USING and WHERE on indexes in PostgreSQL producer diff --git a/lib/SQL/Translator/Producer/POD.pm b/lib/SQL/Translator/Producer/POD.pm index abced98..17c378a 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_C) { + $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";