Upped version numbers, cleaned up code, fixed my name.
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Trigger.pm
index 0f26325..83ff30f 100644 (file)
@@ -54,7 +54,7 @@ use Carp;
 
 use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT);
 
-$VERSION = '1.59';
+$VERSION = '1.60';
 
 # ----------------------------------------------------------------------
 
@@ -402,22 +402,39 @@ Determines if this trigger is the same as another
     
     return 0 unless $self->SUPER::equals($other);
 
-    return 0
-      unless $case_insensitive
-        ? uc( $self->name ) eq uc( $other->name )
-        : $self->name eq $other->name;
+    my %names;
+    for my $name ( $self->name, $other->name ) { 
+        $name = lc $name if $case_insensitive;
+        $names{ $name }++;
+    }
 
-    return 0 unless $self->perform_action_when eq $other->perform_action_when;
+    if ( keys %names > 1 ) {
+        return $self->error('Names not equal');
+    }
 
-    return 0
-      unless compare_arrays( $self->database_events, $other->database_events );
+    if ( !$self->perform_action_when eq $other->perform_action_when ) {
+        return $self->error('perform_action_when differs');
+    }
+
+    if ( 
+        !compare_arrays( [$self->database_events], [$other->database_events] ) 
+    ) {
+        return $self->error('database_events differ');
+    }
 
-    return 0 unless $self->on_table eq $other->on_table;
+    if ( $self->on_table ne $other->on_table ) {
+        return $self->error('on_table differs');
+    }
 
-    return 0 unless $self->action   eq $other->action;
+    if ( $self->action ne $other->action ) {
+        return $self->error('action differs');
+    }
 
-    return 0 unless $self->_compare_objects( scalar $self->extra,
-              scalar $other->extra );
+    if ( 
+        !$self->_compare_objects( scalar $self->extra, scalar $other->extra )
+    ) {
+        return $self->error('extras differ');
+    }
 
     return 1;
 }