Mercurial > pub > Impl
changeset 272:47db27ed5b43
sync
author | sergey |
---|---|
date | Mon, 28 Jan 2013 17:24:37 +0400 |
parents | 56364d0c4b4f |
children | ad93c9f4dd93 |
files | Lib/IMPL/SQL/Schema/MySQL/Formatter.pm Lib/IMPL/SQL/Schema/Traits.pm |
diffstat | 2 files changed, 6 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/Lib/IMPL/SQL/Schema/MySQL/Formatter.pm Mon Jan 28 02:43:14 2013 +0400 +++ b/Lib/IMPL/SQL/Schema/MySQL/Formatter.pm Mon Jan 28 17:24:37 2013 +0400 @@ -436,7 +436,8 @@ $self->quote_names( @{ $constraint->{foreignColumns} || [] } ) ), ')'; - if ( my $rule = uc( $constraint->{onDelete} ) ) { + if ( my $rule = $constraint->{onDelete} ) { + $rule = uc($rule); grep $_ eq $rule, @fkRules or die Exception->new( "Invalid onDelete rule specified", $constraint->{name}, $rule ); @@ -444,7 +445,8 @@ push @parts, 'ON DELETE', $rule; } - if ( my $rule = uc( $constraint->{onUpdate} ) ) { + if ( my $rule = $constraint->{onUpdate} ) { + $rule = uc($rule); grep $_ eq $rule, @fkRules or die Exception->new( "Invalid onUpdate rule specified", $constraint->{name}, $rule );
--- a/Lib/IMPL/SQL/Schema/Traits.pm Mon Jan 28 02:43:14 2013 +0400 +++ b/Lib/IMPL/SQL/Schema/Traits.pm Mon Jan 28 17:24:37 2013 +0400 @@ -473,23 +473,18 @@ return 0 if grep not($_), @columns; if (is($constraint,FK)) { - warn "FK"; my $foreignTable = $schema->GetTable($constraint->{foreignTable}) or return 0; - warn "Table OK"; my @foreignColumns = map $foreignTable->GetColumn($_), @{$constraint->{foreignColumns}||[]}; # внешняя таблица имеет нужные столбцы return 0 if grep not($_), @foreignColumns; - - warn "FK Columns OK"; - + + # типы столбцов во внешней таблице совпадают с типами столбцов ограничения return 0 if grep not($columns[$_]->type->SameValue($foreignColumns[$_]->type)), (0 .. $#columns); - - warn "FK Columns types OK"; } return 1;