--- trunk/lib/Reblog/Feeds.pm 2009/01/24 19:35:41 1013 +++ trunk/lib/Reblog/Feeds.pm 2009/01/25 12:57:28 1014 @@ -3,39 +3,64 @@ use strict; use warnings; -use Reblog::Schema; -use Fey::ORM::Table; +use base 'DBIx::Class'; -use Data::Dump qw/dump/; - -my $schema = Reblog::Schema->Schema; - -sub collection_table { 'feeds' }; -my $feeds_table = $schema->table( collection_table ); -has_table( $feeds_table ); -with 'Frey::ORM::Collection'; - -my $items_t = $schema->table( 'items' ); - -=for buggy -my $select_items = Reblog::Schema->Schema->SQLFactoryCrass()->new_select - ->select( $items_t ) - ->from( $items_t ) - ->where( $items_t->column('feed_id'), '=', Fey::Placeholder->new() ) -# ->order_by( $items_t->column('id'), 'ASC' ) - ->limit(5) - ; - -has_many 'items' => ( - isa => 'Reblog::Items', - select => $select_items, - bind_params => sub { $_[0]->id() }, +__PACKAGE__->load_components("Core"); +__PACKAGE__->table("feeds"); +__PACKAGE__->add_columns( + "id", + { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, + "url", + { + data_type => "TEXT", + default_value => undef, + is_nullable => 0, + size => 65535, + }, + "title", + { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 255 }, + "link", + { + data_type => "VARCHAR", + default_value => undef, + is_nullable => 1, + size => 255, + }, + "description", + { + data_type => "VARCHAR", + default_value => undef, + is_nullable => 1, + size => 255, + }, + "xml", + { + data_type => "TEXT", + default_value => undef, + is_nullable => 1, + size => 65535, + }, + "timestamp", + { + data_type => "TIMESTAMP", + default_value => "CURRENT_TIMESTAMP", + is_nullable => 0, + size => 14, + }, + "insert_timestamp", + { + data_type => "TIMESTAMP", + default_value => "0000-00-00 00:00:00", + is_nullable => 0, + size => 14, + }, ); +__PACKAGE__->set_primary_key("id"); -=cut -has_many 'items' => ( table => $items_t ); +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-01-24 17:48:45 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Tv+IMxgng1+BpjFN0Zc8bw -#warn dump( map { $_->name } $users_table->columns ); +# You can replace this text with custom content, and it will be preserved on regeneration 1;