# HG changeset patch # User sergey # Date 1359379477 -14400 # Node ID 47db27ed5b43d10035e19288250557774958616b # Parent 56364d0c4b4f41c7f4838c12d9250033f4e953b8 sync diff -r 56364d0c4b4f -r 47db27ed5b43 Lib/IMPL/SQL/Schema/MySQL/Formatter.pm --- 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 ); diff -r 56364d0c4b4f -r 47db27ed5b43 Lib/IMPL/SQL/Schema/Traits.pm --- 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;