2 class SQL::Translator::Object::Table {
3 use MooseX::Types::Moose qw(Bool HashRef Maybe Str);
4 use MooseX::AttributeHelpers;
5 use SQL::Translator::Types qw(Column Constraint Index Schema Sequence);
6 use SQL::Translator::Object::Schema;
7 extends 'SQL::Translator::Object';
16 metaclass => 'Collection::Hash',
18 isa => HashRef[Column],
20 exists => 'exists_column',
27 my ($self, $body, $column) = @_;
28 $self->$body($column->name, $column);
32 default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
36 metaclass => 'Collection::Hash',
38 isa => HashRef[Index],
40 exists => 'exists_index',
47 my ($self, $body, $index) = @_;
48 $self->$body($index->name, $index);
52 default => sub { {} },
55 has 'constraints' => (
56 metaclass => 'Collection::Hash',
58 isa => HashRef[Constraint],
60 exists => 'exists_constraint',
61 keys => 'constraint_ids',
62 get => 'get_constraint',
66 add_constraint => sub {
67 my ($self, $body, $constraint) = @_;
68 $self->$body($constraint->name, $constraint);
72 default => sub { {} },
76 metaclass => 'Collection::Hash',
78 isa => HashRef[Sequence],
80 exists => 'exists_sequence',
81 keys => 'sequence_ids',
82 get => 'get_sequence',
87 my ($self, $body, $sequence) = @_;
88 $self->$body($sequence->name, $sequence);
92 default => sub { {} },