package MusicApp::Schema::Result::Song; use strict; use warnings; use base qw/DBIx::Class::Core/; __PACKAGE__->table('songs'); __PACKAGE__->add_columns( id => { data_type => 'integer', is_auto_increment => 1, is_nullable => 0, }, title => { data_type => 'varchar', size => 128, is_nullable => 1, }, artist => { data_type => 'varchar', size => 128, is_nullable => 1, }, length => { data_type => 'varchar', size => 16, is_nullable => 1, }, ); __PACKAGE__->set_primary_key('id'); __PACKAGE__->has_many(album_songs => 'MusicApp::Schema::Result::AlbumSong', 'song_id'); __PACKAGE__->many_to_many(albums => 'album_songs', 'album'); 1;