DBIx-Class-Storage-DBI-mysql-Retryable
view release on metacpan or search on metacpan
t/lib/CDTest.pm view on Meta::CPAN
$dbh->do("DROP $type IF EXISTS ".$dbh->quote_identifier($table));
}
}
=head2 populate_schema
CDTest->populate_schema( $schema );
After you deploy your schema, you can use this method to populate the tables with test data.
=cut
sub populate_schema {
my $self = shift;
my $schema = shift;
$schema->populate('Genre', [
[qw/genreid name/],
[qw/1 emo /],
[qw/2 downtempo /],
[qw/3 soundtrack /],
]);
$schema->populate('Artist', [
[ qw/artistid name/ ],
[ 1, 'Caterwauler McCrae' ],
[ 2, 'Random Boy Band' ],
[ 3, 'We Are Goth' ],
# These gaps are intentional
[ 10, 'Torroni' ],
[ 11, 'The yy' ],
[ 12, 'Kent' ],
[ 15, 'A582' ],
[ 17, 'Lunar Eclipse' ],
]);
$schema->populate('CD', [
[ qw/cdid artist title year prev_cdid genreid/ ],
[ 1, 1, "Spoonful of bees", 1999, undef, 1 ],
[ 2, 1, "Forkful of bees", 2001, 1 ],
[ 3, 1, "Caterwaulin' Blues", 1997, 2 ],
[ 4, 2, "Generic Manufactured Singles", 2001 ],
[ 5, 3, "Come Be Depressed With Us", 1998 ],
[ 9, 10, "Me and You", 2007, undef, 2 ],
[ 10, 11, "Co-Founder", 2011, undef, 2 ],
[ 11, 12, "Independence Park", 2001 ],
[ 15, 12, "Flaming Dragon", 2007, 11 ],
[ 16, 12, "Kent", 2014, 15 ],
[ 17, 15, "42 Minutes of Silence", 2011 ],
[ 19, 15, "Two", 2012, 17 ],
[ 21, 15, "852", 2015, 19 ],
[ 22, 17, "Glass Window Soundtrack", 2009 ],
[ 24, 17, "Magenta", 2014, 22 ],
[ 25, 17, "Yellow", 2014, 24 ],
[ 30, 17, "Cyan", 2014, 25 ],
]);
$schema->populate('Tag', [
[ qw/tagid cd tag/ ],
[ 1, 1, "Blue" ],
[ 2, 2, "Blue" ],
[ 3, 3, "Blue" ],
[ 4, 5, "Blue" ],
[ 5, 2, "Cheesy" ],
[ 6, 4, "Cheesy" ],
[ 7, 5, "Cheesy" ],
[ 8, 2, "Shiny" ],
[ 9, 4, "Shiny" ],
]);
$schema->populate('Producer', [
[ qw/producerid name/ ],
[ 1, 'Matt S Trout' ],
[ 2, 'Bob The Builder' ],
[ 3, 'Fred The Phenotype' ],
[ 4, 'Various' ],
]);
$schema->populate('CDToProducer', [
[ qw/cd producer/ ],
[ 1, 1 ],
[ 1, 2 ],
[ 1, 3 ],
[ 2, 2 ],
[ 3, 2 ],
[ 3, 3 ],
[ 4, 1 ],
map { [ $_, 4 ] } qw< 9 10 11 15 16 17 19 21 22 24 25 30 >,
]);
$schema->populate('Track', [
[ qw/trackid cd position title/ ],
[ 4, 2, 1, "Stung with Success"],
[ 5, 2, 2, "Stripy"],
[ 6, 2, 3, "Sticky Honey"],
[ 7, 3, 1, "Yowlin"],
[ 8, 3, 2, "Howlin"],
[ 9, 3, 3, "Fowlin"],
[ 10, 4, 1, "Boring Name"],
[ 11, 4, 2, "Boring Song"],
[ 12, 4, 3, "No More Ideas"],
[ 13, 5, 1, "Sad"],
[ 14, 5, 2, "Under The Weather"],
[ 15, 5, 3, "Suicidal"],
[ 16, 1, 1, "The Bees Knees"],
[ 17, 1, 2, "Apiary"],
[ 18, 1, 3, "Beehind You"],
[ 20, 9, 1, "Diamond Circus"],
[ 21, 9, 2, "We're Crazy"],
[ 22, 9, 3, "First Heart"],
[ 23, 10, 1, "World Of Old"],
[ 24, 10, 2, "Story Of More"],
[ 26, 10, 3, "Home Secrets"],
[ 27, 10, 4, "Matter Of Right Now"],
[ 28, 11, 1, "Dance Tales"],
[ 29, 11, 2, "She Hopes We Like To Party"],
[ 30, 11, 3, "Stop Rhythm"],
[ 32, 15, 1, "Story Of My Party"],
( run in 1.705 second using v1.01-cache-2.11-cpan-5735350b133 )