# First, create the Models # lib/MusicApp/Schema/Result/Album.pm package MusicApp::Schema::Result::Album; use strict; use warnings; use base qw/DBIx::Class::Core/; __PACKAGE__->table('albums'); __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, }, ); __PACKAGE__->set_primary_key('id'); __PACKAGE__->has_many(album_songs => 'MusicApp::Schema::Result::AlbumSong', 'album_id'); __PACKAGE__->many_to_many(songs => 'album_songs', 'song'); 1;