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',
22 values => 'get_columns',
28 my ($self, $body, $column) = @_;
29 $self->$body($column->name, $column);
33 default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
37 metaclass => 'Collection::Hash',
39 isa => HashRef[Index],
41 exists => 'exists_index',
43 values => 'get_indices',
49 my ($self, $body, $index) = @_;
50 $self->$body($index->name, $index);
54 default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
57 has 'constraints' => (
58 metaclass => 'Collection::Hash',
60 isa => HashRef[Constraint],
62 exists => 'exists_constraint',
63 keys => 'constraint_ids',
64 values => 'get_constraints',
65 get => 'get_constraint',
69 add_constraint => sub {
70 my ($self, $body, $constraint) = @_;
71 $self->$body($constraint->name, $constraint);
75 default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
79 metaclass => 'Collection::Hash',
81 isa => HashRef[Sequence],
83 exists => 'exists_sequence',
84 keys => 'sequence_ids',
85 values => 'get_sequences',
86 get => 'get_sequence',
91 my ($self, $body, $sequence) = @_;
92 $self->$body($sequence->name, $sequence);
96 default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
110 method get_fields { return $self->get_columns }