2 class SQL::Translator::Object::Trigger extends SQL::Translator::Object {
3 use MooseX::Types::Moose qw(Any ArrayRef HashRef Str);
4 use MooseX::MultiMethods;
5 use SQL::Translator::Types qw(Column Schema Table);
28 isa => HashRef[Column],
30 exists_column => 'exists',
32 get_columns => 'values',
35 clear_columns => 'clear',
37 default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
44 # trigger => sub { my ($self, $new, $old) = @_; $self->table($self->schema->get_table($new)) },
52 has 'perform_action_when' => (
58 has '_database_events' => (
63 _database_eventss => 'elements',
64 add_database_event => 'push',
65 remove_last_database_option => 'pop',
67 default => sub { [] },
71 around add_column(Column $column) { $self->$orig($column->name, $column) }
73 multi method database_events(Str $database_event) { $self->add_database_event($database_event); $self->database_events }
74 multi method database_events(ArrayRef $database_events) { $self->add_database_event($_) for @$database_events; $self->database_events }
75 multi method database_events { wantarray ? $self->_database_events : $self->_database_events }