add an around remove_trigger to make sure trigger actually exists
Justin Hunter [Wed, 13 Jan 2010 00:50:29 +0000 (16:50 -0800)]
lib/SQL/Translator/Object/Schema.pm

index 4f02431..0a954f2 100644 (file)
@@ -112,6 +112,12 @@ class SQL::Translator::Object::Schema extends SQL::Translator::Object {
         $self->$orig($name);
     }
 
+    around remove_trigger(Trigger|Str $trigger) {
+        my $name = is_Trigger($trigger) ? $trigger->name : $trigger;
+        die "Can't drop non-existant trigger " . $name unless $self->exists_trigger($name);
+        $self->$orig($name);
+    }
+
     method order { }
     method perform_action_when { }
     method database_events { }