1 package SQL::Translator::Object::Table;
2 use namespace::autoclean;
4 use MooseX::Types::Moose qw(HashRef Str);
5 use MooseX::AttributeHelpers;
6 use SQL::Translator::Types qw(Column Constraint Index Schema);
7 use SQL::Translator::Object::Schema;
8 extends 'SQL::Translator::Object';
17 metaclass => 'Collection::Hash',
19 isa => HashRef[Column],
21 exists => 'exists_column',
25 curries => { set => { add_column => sub { my ($self, $body, $column) = @_; $self->$body($column->name, $column); } } },
26 default => sub { {} },
31 metaclass => 'Collection::Hash',
33 isa => HashRef[Index],
35 exists => 'exists_index',
39 curries => { set => { add_index => sub { my ($self, $body, $index) = @_; $self->$body($index->name, $index); } } },
40 default => sub { {} },
44 has 'constraints' => (
45 metaclass => 'Collection::Hash',
47 isa => HashRef[Constraint],
49 exists => 'exists_constraint',
50 keys => 'constraint_ids',
51 get => 'get_constraint',
53 curries => { set => { add_constraint => sub { my ($self, $body, $constraint) = @_; $self->$body($constraint->name, $constraint); } } },
54 default => sub { {} },
58 __PACKAGE__->meta()->make_immutable;