comparison Lib/IMPL/SQL/Schema/Diff.pm @ 315:77df11605d3a

code cleanup
author cin
date Tue, 07 May 2013 02:19:24 +0400
parents 56364d0c4b4f
children
comparison
equal deleted inserted replaced
314:109f28643025 315:77df11605d3a
1 package IMPL::SQL::Schema::Diff; 1 package IMPL::SQL::Schema::Diff;
2 use strict; 2 use strict;
3 use warnings; 3 use warnings;
4 use IMPL::lang qw(:compare :hash is); 4 use IMPL::lang qw(:compare :hash is typeof);
5 5
6 use IMPL::SQL::Schema::Traits(); 6 use IMPL::SQL::Schema::Traits();
7 7
8 use IMPL::require { 8 use IMPL::require {
9 Schema => 'IMPL::SQL::Schema', 9 Schema => 'IMPL::SQL::Schema',
170 PrimaryKey , TraitsPrimaryKey, 170 PrimaryKey , TraitsPrimaryKey,
171 UniqueConstraint , TraitsUnique, 171 UniqueConstraint , TraitsUnique,
172 Index , TraitsIndex 172 Index , TraitsIndex
173 }; 173 };
174 174
175 my $class = $map->{$constraint->typeof} or die Exception->new("Can't map the constraint",$constraint->typeof); 175 my $class = $map->{typeof($constraint)} or die Exception->new("Can't map the constraint",typeof($constraint));
176 176
177 if ($class eq TraitsForeignKey) { 177 if ($class eq TraitsForeignKey) {
178 return $class->new( 178 return $class->new(
179 $constraint->name, 179 $constraint->name,
180 [ map $_->name, $constraint->columns ], 180 [ map $_->name, $constraint->columns ],