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