do not include .git directory
[catagits/Reaction.git] / t / lib / RTest / TestDB / Baz.pm
CommitLineData
7adfd53f 1package # hide from PAUSE
2 RTest::TestDB::Baz;
3
082e6aee 4use Moose;
3cbb53fc 5extends 'DBIx::Class::Core';
7adfd53f 6
99535516 7use MooseX::Types::Moose qw/ArrayRef Int Bool Str/;
baee102d 8use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
7adfd53f 9
082e6aee 10has 'id' => (isa => Int, is => 'ro', required => 1);
ed6d9da8 11has 'name' => (isa => NonEmptySimpleStr, is => 'rw', required => 1);
99535516 12has 'description' => (isa => Str, is => 'rw',);
c2f0e9e9 13has 'bool_field' => (isa => Bool, is => 'rw', required => 0);
510f6c25 14has 'foo_list' => (
13312031 15 isa => ArrayRef,
16 is => 'rw',
17 required => 1,
18 writer => 'set_foo_list',
19 reader => 'get_foo_list',
20);
510f6c25 21
22around get_foo_list => sub { [ $_[1]->foo_list->all ] };
7adfd53f 23
082e6aee 24use namespace::clean -except => [ 'meta' ];
7adfd53f 25
26__PACKAGE__->table('baz');
27
28__PACKAGE__->add_columns(
29 id => { data_type => 'integer', size => 16, is_auto_increment => 1 },
30 name => { data_type => 'varchar', size => 255 },
99535516 31 description => { data_type => 'text', is_nullable => 1 },
c2f0e9e9 32 bool_field => {
33 data_type => 'char',
34 size => '1',
35 is_nullable => '1'
36 }
7adfd53f 37);
38
7adfd53f 39__PACKAGE__->set_primary_key('id');
40
41__PACKAGE__->has_many('links_to_foo_list' => 'RTest::TestDB::FooBaz', 'baz');
42__PACKAGE__->many_to_many('foo_list' => 'links_to_foo_list' => 'foo');
43
082e6aee 44sub display_name { shift->name; }
45
c689b58e 46__PACKAGE__->meta->make_immutable(inline_constructor => 0);
a5200252 47
7adfd53f 481;