remove redundant required => 0
[dbsrgits/SQL-Translator-2.0-ish.git] / lib / SQL / Translator / Object / Table.pm
CommitLineData
c5051351 1package SQL::Translator::Object::Table;
abb2c327 2use namespace::autoclean;
c5051351 3use Moose;
109263d0 4use MooseX::Types::Moose qw(HashRef Str);
5use MooseX::AttributeHelpers;
cc0972be 6use SQL::Translator::Types qw(Column Constraint Index Schema Sequence);
bbdcd43e 7use SQL::Translator::Object::Schema;
cc73c25e 8extends 'SQL::Translator::Object';
c5051351 9
109263d0 10has 'name' => (
44547961 11 is => 'rw',
12 isa => Str,
13 required => 1
109263d0 14);
15
16has 'columns' => (
44547961 17 metaclass => 'Collection::Hash',
18 is => 'rw',
19 isa => HashRef[Column],
20 provides => {
21 exists => 'exists_column',
22 keys => 'column_ids',
23 get => 'get_column',
24 },
25 curries => {
26 set => {
27 add_column => sub {
28 my ($self, $body, $column) = @_;
29 $self->$body($column->name, $column);
30 }
31 }
32 },
33 default => sub { {} },
109263d0 34);
35
36has 'indexes' => (
44547961 37 metaclass => 'Collection::Hash',
38 is => 'rw',
39 isa => HashRef[Index],
40 provides => {
41 exists => 'exists_index',
42 keys => 'index_ids',
43 get => 'get_index',
44 },
45 curries => {
46 set => {
47 add_index => sub {
48 my ($self, $body, $index) = @_;
49 $self->$body($index->name, $index);
50 }
51 }
52 },
53 default => sub { {} },
109263d0 54);
55
56has 'constraints' => (
44547961 57 metaclass => 'Collection::Hash',
58 is => 'rw',
59 isa => HashRef[Constraint],
60 provides => {
61 exists => 'exists_constraint',
62 keys => 'constraint_ids',
63 get => 'get_constraint',
64 },
65 curries => {
66 set => {
67 add_constraint => sub {
68 my ($self, $body, $constraint) = @_;
69 $self->$body($constraint->name, $constraint);
70 }
71 }
72 },
73 default => sub { {} },
109263d0 74);
75
cc0972be 76has 'sequences' => (
44547961 77 metaclass => 'Collection::Hash',
78 is => 'rw',
79 isa => HashRef[Sequence],
80 provides => {
81 exists => 'exists_sequence',
82 keys => 'sequence_ids',
83 get => 'get_sequence',
84 },
85 curries => {
86 set => {
87 add_sequence => sub {
88 my ($self, $body, $sequence) = @_;
89 $self->$body($sequence->name, $sequence);
90 }
91 }
92 },
93 default => sub { {} },
cc0972be 94);
95
96__PACKAGE__->meta->make_immutable;
c5051351 97
981;