package My::Schema::Result::CD; use strict; use warnings; use base qw ( DBIx::Class::Core ); __PACKAGE__->table_class( 'DBIx::Class::ResultSource::View' ); # specify components __PACKAGE__->load_components( qw/ Ordered / ); __PACKAGE__->position_column( 'title' ); # specify table for Result class __PACKAGE__->table( 'cd_view' ); # add columns to 'this' class __PACKAGE__->add_columns( qw/ RN cdid artistid title year / ); # specify primary key(s) __PACKAGE__->set_primary_key( qw/ cdid artistid/ ); # # specify relationships etc.. # # do not attempt to deploy() this view __PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance ->view_definition(q[ SELECT ROW_NUMBER() OVER (PARTITION BY artistid ORDER BY cdid) AS RN ,cdid ,artistid ,title ,year FROM cd ]); 1;