eval "use DBD::mysql; use SQL::Translator 0.09;";
plan $@
? ( skip_all => 'needs SQL::Translator 0.09 for testing' )
- : ( tests => 114 );
+ : ( tests => 117 );
}
my $schema = DBICTest->init_schema();
{ 'DBICTest::Schema' => [qw/
LinerNotes
Artwork
+ Artwork_to_Artist
Image
Lyrics
LyricVersion
{ cascade_copy => 0 } # this would *so* not make sense
);
+__PACKAGE__->has_many(
+ artist_to_artwork => 'DBICTest::Schema::Artwork_to_Artist' => 'artist_id'
+);
+__PACKAGE__->many_to_many('artworks', 'artist_to_artwork', 'artwork');
+
+
sub sqlt_deploy_hook {
my ($self, $sqlt_table) = @_;
-package # hide from PAUSE
+package # hide from PAUSE
DBICTest::Schema::Artwork;
use base qw/DBIx::Class::Core/;
__PACKAGE__->belongs_to('cd', 'DBICTest::Schema::CD', 'cd_id');
__PACKAGE__->has_many('images', 'DBICTest::Schema::Image', 'artwork_id');
+__PACKAGE__->has_many('artwork_to_artist', 'DBICTest::Schema::Artwork_to_Artist', 'artwork_cd_id');
+__PACKAGE__->many_to_many('artists', 'artwork_to_artist', 'artist');
+
1;
--- /dev/null
+package # hide from PAUSE
+ DBICTest::Schema::Artwork_to_Artist;
+
+use base qw/DBIx::Class::Core/;
+
+__PACKAGE__->table('artwork_to_artist');
+__PACKAGE__->add_columns(
+ 'artwork_cd_id' => {
+ data_type => 'integer',
+ is_foreign_key => 1,
+ },
+ 'artist_id' => {
+ data_type => 'integer',
+ is_foreign_key => 1,
+ },
+);
+__PACKAGE__->set_primary_key(qw/artwork_cd_id artist_id/);
+__PACKAGE__->belongs_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_cd_id');
+__PACKAGE__->belongs_to('artist', 'DBICTest::Schema::Artist', 'artist_id');
+
+1;
--
-- Created by SQL::Translator::Producer::SQLite
--- Created on Mon Nov 17 02:53:11 2008
+-- Created on Sun Nov 23 13:27:13 2008
--
BEGIN TRANSACTION;
CREATE INDEX cd_artwork_idx_cd_id_cd_artwor ON cd_artwork (cd_id);
--
+-- Table: artwork_to_artist
+--
+CREATE TABLE artwork_to_artist (
+ artwork_cd_id integer NOT NULL,
+ artist_id integer NOT NULL,
+ PRIMARY KEY (artwork_cd_id, artist_id)
+);
+
+CREATE INDEX artwork_to_artist_idx_artist_id_artwork_to_arti ON artwork_to_artist (artist_id);
+CREATE INDEX artwork_to_artist_idx_artwork_cd_id_artwork_to_ ON artwork_to_artist (artwork_cd_id);
+
+--
-- Table: bookmark
--
CREATE TABLE bookmark (