9 my $schema = DBICTest->init_schema();
12 my $artist = $schema->resultset("Artist")->create({ name => 'Michael Jackson' });
13 foreach my $year (1975..1985) {
14 $artist->create_related('cds', { year => $year, title => 'Compilation from ' . $year });
17 my @cds_80s = $artist->cds_80s;
19 is(@cds_80s, 6, '6 80s cds found');
21 map { ok($_->year < 1990 && $_->year > 1979) } @cds_80s;
27 for my $cd ($schema->resultset('CD')->search ({}, { order_by => 'cdid'})->all) {
28 push @last_track_ids, $cd->tracks
29 ->search ({}, { order_by => { -desc => 'position'} })
30 ->get_column ('trackid')
34 my $last_tracks = $schema->resultset('Track')->search (
35 {'next_track.trackid' => undef},
36 { join => 'next_track', order_by => 'me.cd' },
40 [$last_tracks->get_column ('trackid')->all],
42 'last group-entry via self-join works',