add MXAH
[dbsrgits/SQL-Translator-2.0-ish.git] / lib / SQL / Translator / Object / Table.pm
1 package SQL::Translator::Object::Table;
2 use Moose;
3 use MooseX::Types::Moose qw(HashRef Str);
4 use MooseX::AttributeHelpers;
5 use SQL::Translator::Types qw(Column Constraint Index Schema);
6 use SQL::Translator::Object::Schema;
7 extends 'SQL::Translator::Object';
8
9 has 'name' => (
10   is => 'rw',
11   isa => Str,
12   required => 1
13 );
14
15 has 'columns' => (
16   metaclass => 'Collection::Hash',
17   is => 'rw',
18   isa => HashRef[Column],
19   provides => {
20     exists => 'exists_column',
21     keys   => 'column_ids',
22     get    => 'get_column',
23     set    => 'set_column',
24   },
25   required => 0
26 );
27
28 has 'indexes' => (
29   metaclass => 'Collection::Hash',
30   is => 'rw',
31   isa => HashRef[Index],
32   provides => {
33     exists => 'exists_index',
34     keys   => 'index_ids',
35     get    => 'get_index',
36     set    => 'set_index',
37   },
38   required => 0
39 );
40
41 has 'constraints' => (
42   metaclass => 'Collection::Hash',
43   is => 'rw',
44   isa => HashRef[Constraint],
45   provides => {
46     exists => 'exists_constraint',
47     keys   => 'constraint_ids',
48     get    => 'get_constraint',
49     set    => 'set_constraint',
50   },
51   required => 0
52 );
53
54 has 'schema' => (
55   is => 'rw',
56   isa => Schema,
57   required => 0,
58   default => sub { SQL::Translator::Object::Schema->new }
59 );
60
61 1;