Music::DBI->connection(
$Music::Config::instance
->get_connection_data);
sub
accessor_name {
"get_$_[1]"
}
sub
mutator_name {
"set_$_[1]"
}
sub
autoupdate { 1 }
Music::Artist->table(
'artist'
);
Music::Artist->columns(
All
=>
qw/id name notes/
);
Music::Artist->has_many(
albums
=>
'Music::Album'
, {
order_by
=>
'title'
} );
Music::Genre->table(
'genre'
);
Music::Genre->columns(
All
=>
qw/id name/
);
Music::Album->table(
'album'
);
Music::Album->columns(
All
=>
qw/id artist genre title year notes/
);
Music::Album->has_a(
artist
=>
'Music::Artist'
);
Music::Album->has_a(
genre
=>
'Music::Genre'
);
Music::Album->has_many(
songs
=>
'Music::Song'
, {
order_by
=>
'nr'
} );
Music::Song->table(
'song'
);
Music::Song->columns(
All
=>
qw/id album title nr/
);
Music::Song->has_a(
album
=>
'Music::Album'
);
1;