From: Ken Youens-Clark Date: Sun, 25 Jan 2004 18:10:55 +0000 (+0000) Subject: Fixed constraints and indices. X-Git-Tag: v0.06~234 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=623a0a9ea24184be460fc6d6f11f33ac47b95335;p=dbsrgits%2FSQL-Translator.git Fixed constraints and indices. --- diff --git a/lib/SQL/Translator/Parser/YAML.pm b/lib/SQL/Translator/Parser/YAML.pm index e0ee2ea..9bc310e 100644 --- a/lib/SQL/Translator/Parser/YAML.pm +++ b/lib/SQL/Translator/Parser/YAML.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::YAML; # ------------------------------------------------------------------- -# $Id: YAML.pm,v 1.3 2003-10-09 21:48:55 kycl4rk Exp $ +# $Id: YAML.pm,v 1.4 2004-01-25 18:10:55 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 darren chamberlain , # Ken Y. Clark . @@ -23,7 +23,7 @@ package SQL::Translator::Parser::YAML; use strict; use vars qw($VERSION); -$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; use SQL::Translator::Schema; use SQL::Translator::Utils qw(header_comment); @@ -66,6 +66,14 @@ sub parse { $table->primary_key( $fdata->{'name'} ) if $fdata->{'is_primary_key'}; } + + for my $idata ( @{ $tdata->{'indices'} || [] } ) { + $table->add_index( %$idata ) or die $table->error; + } + + for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { + $table->add_constraint( %$cdata ) or die $table->error; + } } #