Mercurial > pub > Impl
diff Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm @ 168:6148f89bb7bf
IMPL::SQL::Schema::Traits::Diff alfa version
IMPL::lang added hash traits
author | sourcer |
---|---|
date | Mon, 16 May 2011 04:30:38 +0400 |
parents | 1f7a6d762394 |
children | 5c82eec23bb6 |
line wrap: on
line diff
--- a/Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm Thu May 12 08:57:19 2011 +0400 +++ b/Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm Mon May 16 04:30:38 2011 +0400 @@ -15,6 +15,7 @@ } __PACKAGE__->PassThroughArgs; +__PACKAGE__->RegisterAlias('fk'); sub CTOR { my ($this,%args) = @_; @@ -26,7 +27,7 @@ my @ReferencedColumns = map {IMPL::SQL::Schema::Constraint::ResolveColumn($args{'referencedTable'},$_)} @{$args{'referencedColumns'}}; my $ForeingPK = $args{'referencedTable'}->primaryKey or die new Exception('The referenced table doesn\'t have a primary key'); - scalar (@ReferencedColumns) == scalar(@{$this->columns}) or die new Exception('A foreing key columns doesn\'t match refenced columns'); + scalar (@ReferencedColumns) == $this->columns->Count or die new Exception('A foreing key columns doesn\'t match refenced columns'); my @ColumnsCopy = @ReferencedColumns; die new Exception('A foreing key columns doesn\'t match refenced columns') if grep { not $_->type->SameValue((shift @ColumnsCopy)->type)} @{$this->columns};