From: Ken Youens-Clark Date: Mon, 4 Aug 2003 21:04:04 +0000 (+0000) Subject: FK defs were leaving out the field name. X-Git-Tag: v0.04~359 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd617ba8fb3ad289b0a82bf7e8dad2b6521285e6;p=dbsrgits%2FSQL-Translator.git FK defs were leaving out the field name. --- diff --git a/lib/SQL/Translator/Producer/Oracle.pm b/lib/SQL/Translator/Producer/Oracle.pm index a6617f1..14e4fa4 100644 --- a/lib/SQL/Translator/Producer/Oracle.pm +++ b/lib/SQL/Translator/Producer/Oracle.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::Oracle; # ------------------------------------------------------------------- -# $Id: Oracle.pm,v 1.14 2003-07-18 22:55:18 kycl4rk Exp $ +# $Id: Oracle.pm,v 1.15 2003-08-04 21:04:04 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -24,7 +24,7 @@ package SQL::Translator::Producer::Oracle; use strict; use vars qw[ $VERSION $DEBUG $WARN ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.14 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.15 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use SQL::Translator::Schema::Constants; @@ -284,8 +284,13 @@ sub produce { } elsif ( $c->type eq FOREIGN_KEY ) { $name ||= mk_name( $table_name, ++$constraint_name_default ); - my $def = "CONSTRAINT $name FOREIGN KEY REFERENCES ". - $c->reference_table; + my $def = "CONSTRAINT $name FOREIGN KEY "; + + if ( @fields ) { + $def .= join( ', ', @fields ); + } + + $def .= ' REFERENCES ' . $c->reference_table; if ( @rfields ) { $def .= ' (' . join( ', ', @rfields ) . ')';