add drop_view
[dbsrgits/SQL-Translator-2.0-ish.git] / lib / SQL / Translator / Object / Trigger.pm
CommitLineData
4f4fd192 1use MooseX::Declare;
ebf2721d 2class SQL::Translator::Object::Trigger extends SQL::Translator::Object {
c53f9843 3 use MooseX::Types::Moose qw(Any ArrayRef HashRef Str);
3fb92fdf 4 use SQL::Translator::Types qw(Column);
4f4fd192 5
6 has 'name' => (
7 is => 'ro',
8 isa => Str,
9 required => 1
10 );
3fb92fdf 11
12 has 'columns' => (
28bd628e 13 traits => ['Hash'],
3fb92fdf 14 is => 'rw',
15 isa => HashRef[Column],
28bd628e 16 handles => {
17 exists_column => 'exists',
18 column_ids => 'keys',
19 get_columns => 'values',
20 get_column => 'get',
21 add_column => 'set',
3fb92fdf 22 },
23 default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
24 );
25
26 has 'on_table' => (
27 is => 'rw',
28 isa => Str,
29 required => 1
30 );
31
32 has 'action' => (
33 is => 'rw',
c53f9843 34 isa => Any
3fb92fdf 35 );
36
37 has 'perform_action_when' => (
38 is => 'rw',
39 isa => Str,
40 required => 1
41 );
42
43 has 'database_events' => (
44 is => 'rw',
45 isa => ArrayRef,
46 required => 1
47 );
48
51700db2 49 around add_column(Column $column) { $self->$orig($column->name, $column) }
4f4fd192 50}