1 package # hide from PAUSE
7 use aliased 'RTest::TestDB::Foo';
8 use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
9 use MooseX::Types::DateTime qw/DateTime/;
10 use Reaction::Types::File 'File';
12 has 'name' => (isa => NonEmptySimpleStr, is => 'rw', required => 1);
13 has 'foo' => (isa => Foo, is => 'rw', required => 1);
14 has 'published_at' => (isa => DateTime, is => 'rw');
15 has 'avatar' => (isa => File, is => 'rw');
17 use namespace::clean -except => [ 'meta' ];
19 __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
21 __PACKAGE__->table('bar');
23 __PACKAGE__->add_columns(
24 name => { data_type => 'varchar', size => 255 },
25 foo_id => { data_type => 'integer', size => 16 },
26 published_at => { data_type => 'datetime', is_nullable => 1 },
27 avatar => { data_type => 'blob', is_nullable => 1 },
30 __PACKAGE__->set_primary_key('name');
32 __PACKAGE__->belongs_to(
34 { 'foreign.id' => 'self.foo_id' }
37 sub display_name{ shift->name }
39 __PACKAGE__->meta->make_immutable(inline_constructor => 0);