+++ /dev/null
-package # hide from PAUSE
- DBICTest;
-
-use strict;
-use warnings;
-use DBICTest::AuthorCheck;
-use DBICTest::Schema;
-
-=head1 NAME
-
-DBICTest - Library to be used by DBIx::Class test scripts.
-
-=head1 SYNOPSIS
-
- use lib qw(t/lib);
- use DBICTest;
- use Test::More;
-
- my $schema = DBICTest->init_schema();
-
-=head1 DESCRIPTION
-
-This module provides the basic utilities to write tests against
-DBIx::Class.
-
-=head1 METHODS
-
-=head2 init_schema
-
- my $schema = DBICTest->init_schema(
- no_deploy=>1,
- no_populate=>1,
- storage_type=>'::DBI::Replicated',
- storage_type_args=>{
- balancer_type=>'DBIx::Class::Storage::DBI::Replicated::Balancer::Random'
- },
- );
-
-This method removes the test SQLite database in t/var/DBIxClass.db
-and then creates a new, empty database.
-
-This method will call deploy_schema() by default, unless the
-no_deploy flag is set.
-
-Also, by default, this method will call populate_schema() by
-default, unless the no_deploy or no_populate flags are set.
-
-=cut
-
-sub has_custom_dsn {
- return $ENV{"DBICTEST_DSN"} ? 1:0;
-}
-
-sub _sqlite_dbfilename {
- return "t/var/DBIxClass.db";
-}
-
-sub _sqlite_dbname {
- my $self = shift;
- my %args = @_;
- return $self->_sqlite_dbfilename if $args{sqlite_use_file} or $ENV{"DBICTEST_SQLITE_USE_FILE"};
- return ":memory:";
-}
-
-sub _database {
- my $self = shift;
- my %args = @_;
- my $db_file = $self->_sqlite_dbname(%args);
-
- unlink($db_file) if -e $db_file;
- unlink($db_file . "-journal") if -e $db_file . "-journal";
- mkdir("t/var") unless -d "t/var";
-
- my $dsn = $ENV{"DBICTEST_DSN"} || "dbi:SQLite:${db_file}";
- my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
- my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
-
- my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1, %args });
-
- return @connect_info;
-}
-
-sub init_schema {
- my $self = shift;
- my %args = @_;
-
- my $schema;
-
- if ($args{compose_connection}) {
- $schema = DBICTest::Schema->compose_connection(
- 'DBICTest', $self->_database(%args)
- );
- } else {
- $schema = DBICTest::Schema->compose_namespace('DBICTest');
- }
- if( $args{storage_type}) {
- $schema->storage_type($args{storage_type});
- }
- if ( !$args{no_connect} ) {
- $schema = $schema->connect($self->_database(%args));
- $schema->storage->on_connect_do(['PRAGMA synchronous = OFF'])
- unless $self->has_custom_dsn;
- }
- if ( !$args{no_deploy} ) {
- __PACKAGE__->deploy_schema( $schema, $args{deploy_args} );
- __PACKAGE__->populate_schema( $schema )
- if( !$args{no_populate} );
- }
- return $schema;
-}
-
-=head2 deploy_schema
-
- DBICTest->deploy_schema( $schema );
-
-This method does one of two things to the schema. It can either call
-the experimental $schema->deploy() if the DBICTEST_SQLT_DEPLOY environment
-variable is set, otherwise the default is to read in the t/lib/sqlite.sql
-file and execute the SQL within. Either way you end up with a fresh set
-of tables for testing.
-
-=cut
-
-sub deploy_schema {
- my $self = shift;
- my $schema = shift;
- my $args = shift || {};
-
- if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
- $schema->deploy($args);
- } else {
- open IN, "t/lib/sqlite.sql";
- my $sql;
- { local $/ = undef; $sql = <IN>; }
- close IN;
- for my $chunk ( split (/;\s*\n+/, $sql) ) {
- if ( $chunk =~ / ^ (?! --\s* ) \S /xm ) { # there is some real sql in the chunk - a non-space at the start of the string which is not a comment
- $schema->storage->dbh_do(sub { $_[1]->do($chunk) }) or print "Error on SQL: $chunk\n";
- }
- }
- }
- return;
-}
-
-=head2 populate_schema
-
- DBICTest->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 /],
- ]);
-
- $schema->populate('Artist', [
- [ qw/artistid name/ ],
- [ 1, 'Caterwauler McCrae' ],
- [ 2, 'Random Boy Band' ],
- [ 3, 'We Are Goth' ],
- ]);
-
- $schema->populate('CD', [
- [ qw/cdid artist title year genreid/ ],
- [ 1, 1, "Spoonful of bees", 1999, 1 ],
- [ 2, 1, "Forkful of bees", 2001 ],
- [ 3, 1, "Caterwaulin' Blues", 1997 ],
- [ 4, 2, "Generic Manufactured Singles", 2001 ],
- [ 5, 3, "Come Be Depressed With Us", 1998 ],
- ]);
-
- $schema->populate('LinerNotes', [
- [ qw/liner_id notes/ ],
- [ 2, "Buy Whiskey!" ],
- [ 4, "Buy Merch!" ],
- [ 5, "Kill Yourself!" ],
- ]);
-
- $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('TwoKeys', [
- [ qw/artist cd/ ],
- [ 1, 1 ],
- [ 1, 2 ],
- [ 2, 2 ],
- ]);
-
- $schema->populate('FourKeys', [
- [ qw/foo bar hello goodbye sensors/ ],
- [ 1, 2, 3, 4, 'online' ],
- [ 5, 4, 3, 6, 'offline' ],
- ]);
-
- $schema->populate('OneKey', [
- [ qw/id artist cd/ ],
- [ 1, 1, 1 ],
- [ 2, 1, 2 ],
- [ 3, 2, 2 ],
- ]);
-
- $schema->populate('SelfRef', [
- [ qw/id name/ ],
- [ 1, 'First' ],
- [ 2, 'Second' ],
- ]);
-
- $schema->populate('SelfRefAlias', [
- [ qw/self_ref alias/ ],
- [ 1, 2 ]
- ]);
-
- $schema->populate('ArtistUndirectedMap', [
- [ qw/id1 id2/ ],
- [ 1, 2 ]
- ]);
-
- $schema->populate('Producer', [
- [ qw/producerid name/ ],
- [ 1, 'Matt S Trout' ],
- [ 2, 'Bob The Builder' ],
- [ 3, 'Fred The Phenotype' ],
- ]);
-
- $schema->populate('CD_to_Producer', [
- [ qw/cd producer/ ],
- [ 1, 1 ],
- [ 1, 2 ],
- [ 1, 3 ],
- ]);
-
- $schema->populate('TreeLike', [
- [ qw/id parent name/ ],
- [ 1, undef, 'root' ],
- [ 2, 1, 'foo' ],
- [ 3, 2, 'bar' ],
- [ 6, 2, 'blop' ],
- [ 4, 3, 'baz' ],
- [ 5, 4, 'quux' ],
- [ 7, 3, 'fong' ],
- ]);
-
- $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"],
- ]);
-
- $schema->populate('Event', [
- [ qw/id starts_at created_on varchar_date varchar_datetime skip_inflation/ ],
- [ 1, '2006-04-25 22:24:33', '2006-06-22 21:00:05', '2006-07-23', '2006-05-22 19:05:07', '2006-04-21 18:04:06'],
- ]);
-
- $schema->populate('Link', [
- [ qw/id url title/ ],
- [ 1, '', 'aaa' ]
- ]);
-
- $schema->populate('Bookmark', [
- [ qw/id link/ ],
- [ 1, 1 ]
- ]);
-
- $schema->populate('Collection', [
- [ qw/collectionid name/ ],
- [ 1, "Tools" ],
- [ 2, "Body Parts" ],
- ]);
-
- $schema->populate('TypedObject', [
- [ qw/objectid type value/ ],
- [ 1, "pointy", "Awl" ],
- [ 2, "round", "Bearing" ],
- [ 3, "pointy", "Knife" ],
- [ 4, "pointy", "Tooth" ],
- [ 5, "round", "Head" ],
- ]);
- $schema->populate('CollectionObject', [
- [ qw/collection object/ ],
- [ 1, 1 ],
- [ 1, 2 ],
- [ 1, 3 ],
- [ 2, 4 ],
- [ 2, 5 ],
- ]);
-
- $schema->populate('Owners', [
- [ qw/id name/ ],
- [ 1, "Newton" ],
- [ 2, "Waltham" ],
- ]);
-
- $schema->populate('BooksInLibrary', [
- [ qw/id owner title source price/ ],
- [ 1, 1, "Programming Perl", "Library", 23 ],
- [ 2, 1, "Dynamical Systems", "Library", 37 ],
- [ 3, 2, "Best Recipe Cookbook", "Library", 65 ],
- ]);
-}
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::AuthorCheck;
-
-use strict;
-use warnings;
-
-use Path::Class qw/file dir/;
-
-_check_author_makefile() unless $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION};
-
-# Die if the author did not update his makefile
-#
-# This is pretty heavy handed, so the check is pretty solid:
-#
-# 1) Assume that this particular module is loaded from -I <$root>/t/lib
-# 2) Make sure <$root>/Makefile.PL exists
-# 3) Make sure we can stat() <$root>/Makefile.PL
-#
-# If all of the above is satisfied
-#
-# *) die if <$root>/inc does not exist
-# *) die if no stat() results for <$root>/Makefile (covers no Makefile)
-# *) die if Makefile.PL mtime > Makefile mtime
-#
-sub _check_author_makefile {
-
- my $root = _find_co_root()
- or return;
-
- # not using file->stat as it invokes File::stat which in turn breaks stat(_)
- my ($mf_pl_mtime, $mf_mtime) = ( map
- { (stat ($root->file ($_)) )[9] }
- qw/Makefile.PL Makefile/
- );
-
- return unless $mf_pl_mtime; # something went wrong during co_root detection ?
-
- if (
- not -d $root->subdir ('inc')
- or
- not $mf_mtime
- or
- $mf_mtime < $mf_pl_mtime
- ) {
- print STDERR <<'EOE';
-
-
-
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-======================== FATAL ERROR ===========================
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-We have a number of reasons to believe that this is a development
-checkout and that you, the user, did not run `perl Makefile.PL`
-before using this code. You absolutely _must_ perform this step,
-and ensure you have all required dependencies present. Not doing
-so often results in a lot of wasted time for other contributors
-trying to assit you with spurious "its broken!" problems.
-
-If you are seeing this message unexpectedly (i.e. you are in fact
-attempting a regular installation be it through CPAN or manually),
-please report the situation to either the mailing list or to the
-irc channel as described in
-
-http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class.pm#GETTING_HELP/SUPPORT
-
-The DBIC team
-
-
-
-EOE
-
- exit 1;
- }
-}
-
-# Mimic $Module::Install::AUTHOR
-sub is_author {
-
- my $root = _find_co_root()
- or return undef;
-
- return (
- ( not -d $root->subdir ('inc') )
- or
- ( -e $root->subdir ('inc')->file ($^O eq 'VMS' ? '_author' : '.author') )
- );
-}
-
-# Try to determine the root of a checkout/untar if possible
-# or return undef
-sub _find_co_root {
-
- my @mod_parts = split /::/, (__PACKAGE__ . '.pm');
- my $rel_path = join ('/', @mod_parts); # %INC stores paths with / regardless of OS
-
- return undef unless ($INC{$rel_path});
-
- # a bit convoluted, but what we do here essentially is:
- # - get the file name of this particular module
- # - do 'cd ..' as many times as necessary to get to t/lib/../..
-
- my $root = dir ($INC{$rel_path});
- for (1 .. @mod_parts + 2) {
- $root = $root->parent;
- }
-
- return (-f $root->file ('Makefile.PL') )
- ? $root
- : undef
- ;
-}
-
-1;
+++ /dev/null
-package #hide from pause
- DBICTest::BaseResult;
-
-use strict;
-use warnings;
-
-use base qw/DBIx::Class::Core/;
-use DBICTest::BaseResultSet;
-
-__PACKAGE__->table ('bogus');
-__PACKAGE__->resultset_class ('DBICTest::BaseResultSet');
-
-1;
+++ /dev/null
-package #hide from pause
- DBICTest::BaseResultSet;
-
-use strict;
-use warnings;
-
-use base qw/DBIx::Class::ResultSet/;
-
-sub hri_dump {
- return shift->search ({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' });
-}
-
-1;
+++ /dev/null
-# belongs to t/run/90ensure_class_loaded.tl
-package # hide from PAUSE
- DBICTest::ErrorComponent;
-use warnings;
-use strict;
-
-# this is missing on purpose
-# 1;
+++ /dev/null
-# belongs to t/run/90ensure_class_loaded.tl
-package # hide from PAUSE
- DBICTest::FakeComponent;
-use warnings;
-use strict;
-
-1;
+++ /dev/null
-# belongs to t/05components.t
-package # hide from PAUSE
- DBICTest::ForeignComponent;
-use warnings;
-use strict;
-
-use base qw/ DBIx::Class /;
-
-__PACKAGE__->load_components( qw/ +DBICTest::ForeignComponent::TestComp / );
-
-1;
+++ /dev/null
-# belongs to t/05components.t
-package # hide from PAUSE
- DBICTest::ForeignComponent::TestComp;
-use warnings;
-use strict;
-
-sub foreign_test_method { 1 }
-
-1;
+++ /dev/null
-# belongs to t/run/90ensure_class_loaded.tl
-package # hide from PAUSE
- DBICTest::OptionalComponent;
-use warnings;
-use strict;
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Plain;
-
-use strict;
-use warnings;
-use base qw/DBIx::Class::Schema/;
-use DBI;
-
-my $db_file = "t/var/Plain.db";
-
-unlink($db_file) if -e $db_file;
-unlink($db_file . "-journal") if -e $db_file . "-journal";
-mkdir("t/var") unless -d "t/var";
-
-my $dsn = "dbi:SQLite:${db_file}";
-
-__PACKAGE__->load_classes("Test");
-my $schema = __PACKAGE__->compose_connection(
- __PACKAGE__,
- $dsn,
- undef,
- undef,
- { AutoCommit => 1 }
-);
-
-my $dbh = DBI->connect($dsn);
-
-my $sql = <<EOSQL;
-CREATE TABLE test (
- id INTEGER NOT NULL,
- name VARCHAR(32) NOT NULL
-);
-
-INSERT INTO test (id, name) VALUES (1, 'DBIC::Plain is broken!');
-
-EOSQL
-
-$dbh->do($_) for split(/\n\n/, $sql);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Plain::Test;
-
-use base 'DBIx::Class::Core';
-
-__PACKAGE__->table('test');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1
- },
- 'name' => {
- data_type => 'varchar',
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::ResultSetManager;
-use base 'DBIx::Class::Schema';
-
-__PACKAGE__->load_classes("Foo");
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::ResultSetManager::Foo;
-use base 'DBIx::Class::Core';
-
-__PACKAGE__->load_components(qw/ ResultSetManager /);
-__PACKAGE__->table('foo');
-
-sub bar : ResultSet { 'good' }
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema;
-
-use base qw/DBIx::Class::Schema/;
-
-no warnings qw/qw/;
-
-__PACKAGE__->load_classes(qw/
- Artist
- SequenceTest
- BindType
- Employee
- CD
- FileColumn
- Genre
- Link
- Bookmark
- #dummy
- Track
- Tag
- Year2000CDs
- Year1999CDs
- CustomSql
- Money
- /,
- { 'DBICTest::Schema' => [qw/
- LinerNotes
- Artwork
- Artwork_to_Artist
- Image
- Lyrics
- LyricVersion
- OneKey
- #dummy
- TwoKeys
- Serialized
- /]},
- (
- 'FourKeys',
- 'FourKeys_to_TwoKeys',
- '#dummy',
- 'SelfRef',
- 'ArtistUndirectedMap',
- 'ArtistSourceName',
- 'ArtistSubclass',
- 'Producer',
- 'CD_to_Producer',
- 'Dummy', # this is a real result class we remove in the hook below
- ),
- qw/SelfRefAlias TreeLike TwoKeyTreeLike Event EventTZ NoPrimaryKey/,
- qw/Collection CollectionObject TypedObject Owners BooksInLibrary/,
- qw/ForceForeign Encoded/,
-);
-
-sub sqlt_deploy_hook {
- my ($self, $sqlt_schema) = @_;
-
- $sqlt_schema->drop_table('dummy');
-}
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Artist;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('artist');
-__PACKAGE__->source_info({
- "source_info_key_A" => "source_info_value_A",
- "source_info_key_B" => "source_info_value_B",
- "source_info_key_C" => "source_info_value_C",
-});
-__PACKAGE__->add_columns(
- 'artistid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- is_nullable => 1,
- },
- rank => {
- data_type => 'integer',
- default_value => 13,
- },
- charfield => {
- data_type => 'char',
- size => 10,
- is_nullable => 1,
- },
-);
-__PACKAGE__->set_primary_key('artistid');
-__PACKAGE__->add_unique_constraint(artist => ['artistid']); # do not remove, part of a test
-
-__PACKAGE__->mk_classdata('field_name_for', {
- artistid => 'primary key',
- name => 'artist name',
-});
-
-__PACKAGE__->has_many(
- cds => 'DBICTest::Schema::CD', undef,
- { order_by => 'year' },
-);
-__PACKAGE__->has_many(
- cds_unordered => 'DBICTest::Schema::CD'
-);
-__PACKAGE__->has_many(
- cds_very_very_very_long_relationship_name => 'DBICTest::Schema::CD'
-);
-
-__PACKAGE__->has_many( twokeys => 'DBICTest::Schema::TwoKeys' );
-__PACKAGE__->has_many( onekeys => 'DBICTest::Schema::OneKey' );
-
-__PACKAGE__->has_many(
- artist_undirected_maps => 'DBICTest::Schema::ArtistUndirectedMap',
- [ {'foreign.id1' => 'self.artistid'}, {'foreign.id2' => 'self.artistid'} ],
- { cascade_copy => 0 } # this would *so* not make sense
-);
-
-__PACKAGE__->has_many(
- artwork_to_artist => 'DBICTest::Schema::Artwork_to_Artist' => 'artist_id'
-);
-__PACKAGE__->many_to_many('artworks', 'artwork_to_artist', 'artwork');
-
-
-sub sqlt_deploy_hook {
- my ($self, $sqlt_table) = @_;
-
- if ($sqlt_table->schema->translator->producer_type =~ /SQLite$/ ) {
- $sqlt_table->add_index( name => 'artist_name_hookidx', fields => ['name'] )
- or die $sqlt_table->error;
- }
-}
-
-sub store_column {
- my ($self, $name, $value) = @_;
- $value = 'X '.$value if ($name eq 'name' && $value && $value =~ /(X )?store_column test/);
- $self->next::method($name, $value);
-}
-
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::ArtistGUID;
-
-use base qw/DBICTest::BaseResult/;
-
-# test MSSQL uniqueidentifier type
-
-__PACKAGE__->table('artist');
-__PACKAGE__->add_columns(
- 'artistid' => {
- data_type => 'uniqueidentifier' # auto_nextval not necessary for PK
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- is_nullable => 1,
- },
- rank => {
- data_type => 'integer',
- default_value => 13,
- },
- charfield => {
- data_type => 'char',
- size => 10,
- is_nullable => 1,
- },
- a_guid => {
- data_type => 'uniqueidentifier',
- auto_nextval => 1, # necessary here, because not a PK
- is_nullable => 1,
- }
-);
-__PACKAGE__->set_primary_key('artistid');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::ArtistSourceName;
-
-use base 'DBICTest::Schema::Artist';
-__PACKAGE__->table(__PACKAGE__->table);
-__PACKAGE__->source_name('SourceNameArtists');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::ArtistSubclass;
-
-use base 'DBICTest::Schema::Artist';
-
-__PACKAGE__->table(__PACKAGE__->table);
-
-1;
\ No newline at end of file
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::ArtistUndirectedMap;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('artist_undirected_map');
-__PACKAGE__->add_columns(
- 'id1' => { data_type => 'integer' },
- 'id2' => { data_type => 'integer' },
-);
-__PACKAGE__->set_primary_key(qw/id1 id2/);
-
-__PACKAGE__->belongs_to( 'artist1', 'DBICTest::Schema::Artist', 'id1', { on_delete => 'RESTRICT', on_update => 'CASCADE'} );
-__PACKAGE__->belongs_to( 'artist2', 'DBICTest::Schema::Artist', 'id2', { on_delete => undef, on_update => undef} );
-__PACKAGE__->has_many(
- 'mapped_artists', 'DBICTest::Schema::Artist',
- [ {'foreign.artistid' => 'self.id1'}, {'foreign.artistid' => 'self.id2'} ],
-);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Artwork;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('cd_artwork');
-__PACKAGE__->add_columns(
- 'cd_id' => {
- data_type => 'integer',
- is_nullable => 0,
- },
-);
-__PACKAGE__->set_primary_key('cd_id');
-__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/DBICTest::BaseResult/;
-
-__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;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::BindType;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('bindtype_test');
-
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'bytea' => {
- data_type => 'bytea',
- is_nullable => 1,
- },
- 'blob' => {
- data_type => 'blob',
- is_nullable => 1,
- },
- 'clob' => {
- data_type => 'clob',
- is_nullable => 1,
- },
-);
-
-__PACKAGE__->set_primary_key('id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Bookmark;
-
- use base qw/DBICTest::BaseResult/;
-
-
-use strict;
-use warnings;
-
-__PACKAGE__->table('bookmark');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1
- },
- 'link' => {
- data_type => 'integer',
- is_nullable => 1,
- },
-);
-
-__PACKAGE__->set_primary_key('id');
-__PACKAGE__->belongs_to(link => 'DBICTest::Schema::Link', 'link', { on_delete => 'SET NULL' } );
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::BooksInLibrary;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('books');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'source' => {
- data_type => 'varchar',
- size => '100',
- },
- 'owner' => {
- data_type => 'integer',
- },
- 'title' => {
- data_type => 'varchar',
- size => '100',
- },
- 'price' => {
- data_type => 'integer',
- is_nullable => 1,
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-__PACKAGE__->resultset_attributes({where => { source => "Library" } });
-
-__PACKAGE__->belongs_to ( owner => 'DBICTest::Schema::Owners', 'owner' );
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::CD;
-
-use base qw/DBICTest::BaseResult/;
-
-# this tests table name as scalar ref
-# DO NOT REMOVE THE \
-__PACKAGE__->table(\'cd');
-
-__PACKAGE__->add_columns(
- 'cdid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'artist' => {
- data_type => 'integer',
- },
- 'title' => {
- data_type => 'varchar',
- size => 100,
- },
- 'year' => {
- data_type => 'varchar',
- size => 100,
- },
- 'genreid' => {
- data_type => 'integer',
- is_nullable => 1,
- accessor => undef,
- },
- 'single_track' => {
- data_type => 'integer',
- is_nullable => 1,
- is_foreign_key => 1,
- }
-);
-__PACKAGE__->set_primary_key('cdid');
-__PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
-
-__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, {
- is_deferrable => 1,
-});
-
-# in case this is a single-cd it promotes a track from another cd
-__PACKAGE__->belongs_to( single_track => 'DBICTest::Schema::Track', 'single_track',
- { join_type => 'left'}
-);
-
-__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' );
-__PACKAGE__->has_many(
- tags => 'DBICTest::Schema::Tag', undef,
- { order_by => 'tag' },
-);
-__PACKAGE__->has_many(
- cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd'
-);
-
-__PACKAGE__->might_have(
- liner_notes => 'DBICTest::Schema::LinerNotes', undef,
- { proxy => [ qw/notes/ ] },
-);
-__PACKAGE__->might_have(artwork => 'DBICTest::Schema::Artwork', 'cd_id');
-__PACKAGE__->has_one(mandatory_artwork => 'DBICTest::Schema::Artwork', 'cd_id');
-
-__PACKAGE__->many_to_many( producers => cd_to_producer => 'producer' );
-__PACKAGE__->many_to_many(
- producers_sorted => cd_to_producer => 'producer',
- { order_by => 'producer.name' },
-);
-
-__PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre',
- { 'foreign.genreid' => 'self.genreid' },
- {
- join_type => 'left',
- on_delete => 'SET NULL',
- on_update => 'CASCADE',
- },
-);
-
-#This second relationship was added to test the short-circuiting of pointless
-#queries provided by undef_on_null_fk. the relevant test in 66relationship.t
-__PACKAGE__->belongs_to('genre_inefficient', 'DBICTest::Schema::Genre',
- { 'foreign.genreid' => 'self.genreid' },
- {
- join_type => 'left',
- on_delete => 'SET NULL',
- on_update => 'CASCADE',
- undef_on_null_fk => 0,
- },
-);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::CD_to_Producer;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('cd_to_producer');
-__PACKAGE__->add_columns(
- cd => { data_type => 'integer' },
- producer => { data_type => 'integer' },
- attribute => { data_type => 'integer', is_nullable => 1 },
-);
-__PACKAGE__->set_primary_key(qw/cd producer/);
-
-__PACKAGE__->belongs_to(
- 'cd', 'DBICTest::Schema::CD',
- { 'foreign.cdid' => 'self.cd' }
-);
-
-__PACKAGE__->belongs_to(
- 'producer', 'DBICTest::Schema::Producer',
- { 'foreign.producerid' => 'self.producer' },
- { on_delete => undef, on_update => undef },
-);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Collection;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('collection');
-__PACKAGE__->add_columns(
- 'collectionid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('collectionid');
-
-__PACKAGE__->has_many( collection_object => "DBICTest::Schema::CollectionObject",
- { "foreign.collection" => "self.collectionid" }
- );
-__PACKAGE__->many_to_many( objects => collection_object => "object" );
-__PACKAGE__->many_to_many( pointy_objects => collection_object => "object",
- { where => { "object.type" => "pointy" } }
- );
-__PACKAGE__->many_to_many( round_objects => collection_object => "object",
- { where => { "object.type" => "round" } }
- );
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::CollectionObject;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('collection_object');
-__PACKAGE__->add_columns(
- 'collection' => {
- data_type => 'integer',
- },
- 'object' => {
- data_type => 'integer',
- },
-);
-__PACKAGE__->set_primary_key(qw/collection object/);
-
-__PACKAGE__->belongs_to( collection => "DBICTest::Schema::Collection",
- { "foreign.collectionid" => "self.collection" }
- );
-__PACKAGE__->belongs_to( object => "DBICTest::Schema::TypedObject",
- { "foreign.objectid" => "self.object" }
- );
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::ComputedColumn;
-
-# for sybase and mssql computed column tests
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('computed_column_test');
-
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'a_computed_column' => {
- data_type => undef,
- is_nullable => 0,
- default_value => \'getdate()',
- },
- 'a_timestamp' => {
- data_type => 'timestamp',
- is_nullable => 0,
- },
- 'charfield' => {
- data_type => 'varchar',
- size => 20,
- default_value => 'foo',
- is_nullable => 0,
- }
-);
-
-__PACKAGE__->set_primary_key('id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::CustomSql;
-
-use base qw/DBICTest::Schema::Artist/;
-
-__PACKAGE__->table('dummy');
-
-__PACKAGE__->result_source_instance->name(\<<SQL);
- ( SELECT a.*, cd.cdid AS cdid, cd.title AS title, cd.year AS year
- FROM artist a
- JOIN cd ON cd.artist = a.artistid
- WHERE cd.year = ?)
-SQL
-
-sub sqlt_deploy_hook { $_[1]->schema->drop_table($_[1]) }
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Dummy;
-
-use base qw/DBICTest::BaseResult/;
-
-use strict;
-use warnings;
-
-__PACKAGE__->table('dummy');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1
- },
- 'gittery' => {
- data_type => 'varchar',
- size => 100,
- is_nullable => 1,
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Employee;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->load_components(qw( Ordered ));
-
-__PACKAGE__->table('employee');
-
-__PACKAGE__->add_columns(
- employee_id => {
- data_type => 'integer',
- is_auto_increment => 1
- },
- position => {
- data_type => 'integer',
- },
- group_id => {
- data_type => 'integer',
- is_nullable => 1,
- },
- group_id_2 => {
- data_type => 'integer',
- is_nullable => 1,
- },
- group_id_3 => {
- data_type => 'integer',
- is_nullable => 1,
- },
- name => {
- data_type => 'varchar',
- size => 100,
- is_nullable => 1,
- },
-);
-
-__PACKAGE__->set_primary_key('employee_id');
-__PACKAGE__->position_column('position');
-
-#__PACKAGE__->add_unique_constraint(position_group => [ qw/position group_id/ ]);
-
-__PACKAGE__->mk_classdata('field_name_for', {
- employee_id => 'primary key',
- position => 'list position',
- group_id => 'collection column',
- name => 'employee name',
-});
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Encoded;
-
-use base qw/DBICTest::BaseResult/;
-
-use strict;
-use warnings;
-
-__PACKAGE__->table('encoded');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1
- },
- 'encoded' => {
- data_type => 'varchar',
- size => 100,
- is_nullable => 1,
- },
-);
-
-__PACKAGE__->set_primary_key('id');
-
-sub set_column {
- my ($self, $col, $value) = @_;
- if( $col eq 'encoded' ){
- $value = reverse split '', $value;
- }
- $self->next::method($col, $value);
-}
-
-sub new {
- my($self, $attr, @rest) = @_;
- $attr->{encoded} = reverse split '', $attr->{encoded}
- if defined $attr->{encoded};
- return $self->next::method($attr, @rest);
-}
-
-1;
+++ /dev/null
-package DBICTest::Schema::Event;
-
-use strict;
-use warnings;
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
-
-__PACKAGE__->table('event');
-
-__PACKAGE__->add_columns(
- id => { data_type => 'integer', is_auto_increment => 1 },
- starts_at => { data_type => 'datetime' },
- created_on => { data_type => 'timestamp' },
- varchar_date => { data_type => 'varchar', inflate_date => 1, size => 20, is_nullable => 1 },
- varchar_datetime => { data_type => 'varchar', inflate_datetime => 1, size => 20, is_nullable => 1 },
- skip_inflation => { data_type => 'datetime', inflate_datetime => 0, is_nullable => 1 },
- ts_without_tz => { data_type => 'datetime', is_nullable => 1 }, # used in EventTZPg
-);
-
-__PACKAGE__->set_primary_key('id');
-
-1;
+++ /dev/null
-package DBICTest::Schema::EventTZ;
-
-use strict;
-use warnings;
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
-
-__PACKAGE__->table('event');
-
-__PACKAGE__->add_columns(
- id => { data_type => 'integer', is_auto_increment => 1 },
- starts_at => { data_type => 'datetime', timezone => "America/Chicago", locale => 'de_DE', datetime_undef_if_invalid => 1 },
- created_on => { data_type => 'timestamp', timezone => "America/Chicago", floating_tz_ok => 1 },
-);
-
-__PACKAGE__->set_primary_key('id');
-
-sub _datetime_parser {
- require DateTime::Format::MySQL;
- DateTime::Format::MySQL->new();
-}
-
-1;
+++ /dev/null
-package DBICTest::Schema::EventTZDeprecated;
-
-use strict;
-use warnings;
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
-
-__PACKAGE__->table('event');
-
-__PACKAGE__->add_columns(
- id => { data_type => 'integer', is_auto_increment => 1 },
- starts_at => { data_type => 'datetime', extra => { timezone => "America/Chicago", locale => 'de_DE' } },
- created_on => { data_type => 'timestamp', extra => { timezone => "America/Chicago", floating_tz_ok => 1 } },
-);
-
-__PACKAGE__->set_primary_key('id');
-
-sub _datetime_parser {
- require DateTime::Format::MySQL;
- DateTime::Format::MySQL->new();
-}
-
-
-1;
+++ /dev/null
-package DBICTest::Schema::EventTZPg;
-
-use strict;
-use warnings;
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
-
-__PACKAGE__->table('event');
-
-__PACKAGE__->add_columns(
- id => { data_type => 'integer', is_auto_increment => 1 },
- starts_at => { data_type => 'datetime', timezone => "America/Chicago", locale => 'de_DE' },
- created_on => { data_type => 'timestamp with time zone', timezone => "America/Chicago" },
- ts_without_tz => { data_type => 'timestamp without time zone' },
-);
-
-__PACKAGE__->set_primary_key('id');
-
-sub _datetime_parser {
- require DateTime::Format::Pg;
- DateTime::Format::Pg->new();
-}
-
-1;
+++ /dev/null
-package
-DBICTest::Schema::FileColumn;
-
-use strict;
-use warnings;
-use base qw/DBICTest::BaseResult/;
-use File::Temp qw/tempdir/;
-
-__PACKAGE__->load_components(qw/InflateColumn::File/);
-
-__PACKAGE__->table('file_columns');
-
-__PACKAGE__->add_columns(
- id => { data_type => 'integer', is_auto_increment => 1 },
- file => {
- data_type => 'varchar',
- is_file_column => 1,
- file_column_path => tempdir(CLEANUP => 1),
- size => 255
- }
-);
-
-__PACKAGE__->set_primary_key('id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::ForceForeign;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('forceforeign');
-__PACKAGE__->add_columns(
- 'artist' => { data_type => 'integer' },
- 'cd' => { data_type => 'integer' },
-);
-__PACKAGE__->set_primary_key(qw/artist/);
-
-# Normally this would not appear as a FK constraint
-# since it uses the PK
-__PACKAGE__->might_have(
- 'artist_1', 'DBICTest::Schema::Artist', {
- 'foreign.artistid' => 'self.artist',
- }, {
- is_foreign_key_constraint => 1,
- },
-);
-
-# Normally this would appear as a FK constraint
-__PACKAGE__->might_have(
- 'cd_1', 'DBICTest::Schema::CD', {
- 'foreign.cdid' => 'self.cd',
- }, {
- is_foreign_key_constraint => 0,
- },
-);
-
-# Normally this would appear as a FK constraint
-__PACKAGE__->belongs_to(
- 'cd_3', 'DBICTest::Schema::CD', {
- 'foreign.cdid' => 'self.cd',
- }, {
- is_foreign_key_constraint => 0,
- },
-);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::FourKeys;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('fourkeys');
-__PACKAGE__->add_columns(
- 'foo' => { data_type => 'integer' },
- 'bar' => { data_type => 'integer' },
- 'hello' => { data_type => 'integer' },
- 'goodbye' => { data_type => 'integer' },
- 'sensors' => { data_type => 'character', size => 10 },
- 'read_count' => { data_type => 'integer', is_nullable => 1 },
-);
-__PACKAGE__->set_primary_key(qw/foo bar hello goodbye/);
-
-__PACKAGE__->has_many(
- 'fourkeys_to_twokeys', 'DBICTest::Schema::FourKeys_to_TwoKeys', {
- 'foreign.f_foo' => 'self.foo',
- 'foreign.f_bar' => 'self.bar',
- 'foreign.f_hello' => 'self.hello',
- 'foreign.f_goodbye' => 'self.goodbye',
-});
-
-__PACKAGE__->many_to_many(
- 'twokeys', 'fourkeys_to_twokeys', 'twokeys',
-);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::FourKeys_to_TwoKeys;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('fourkeys_to_twokeys');
-__PACKAGE__->add_columns(
- 'f_foo' => { data_type => 'integer' },
- 'f_bar' => { data_type => 'integer' },
- 'f_hello' => { data_type => 'integer' },
- 'f_goodbye' => { data_type => 'integer' },
- 't_artist' => { data_type => 'integer' },
- 't_cd' => { data_type => 'integer' },
- 'autopilot' => { data_type => 'character' },
- 'pilot_sequence' => { data_type => 'integer', is_nullable => 1 },
-);
-__PACKAGE__->set_primary_key(
- qw/f_foo f_bar f_hello f_goodbye t_artist t_cd/
-);
-
-__PACKAGE__->belongs_to('fourkeys', 'DBICTest::Schema::FourKeys', {
- 'foreign.foo' => 'self.f_foo',
- 'foreign.bar' => 'self.f_bar',
- 'foreign.hello' => 'self.f_hello',
- 'foreign.goodbye' => 'self.f_goodbye',
-});
-
-__PACKAGE__->belongs_to('twokeys', 'DBICTest::Schema::TwoKeys', {
- 'foreign.artist' => 'self.t_artist',
- 'foreign.cd' => 'self.t_cd',
-});
-
-1;
+++ /dev/null
-package DBICTest::Schema::Genre;
-
-use strict;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('genre');
-__PACKAGE__->add_columns(
- genreid => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- name => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('genreid');
-__PACKAGE__->add_unique_constraint ( genre_name => [qw/name/] );
-
-__PACKAGE__->has_many (cds => 'DBICTest::Schema::CD', 'genreid');
-
-__PACKAGE__->has_one (model_cd => 'DBICTest::Schema::CD', 'genreid');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Image;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('images');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'artwork_id' => {
- data_type => 'integer',
- is_foreign_key => 1,
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- },
- 'data' => {
- data_type => 'blob',
- is_nullable => 1,
- },
-);
-__PACKAGE__->set_primary_key('id');
-__PACKAGE__->belongs_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::LinerNotes;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('liner_notes');
-__PACKAGE__->add_columns(
- 'liner_id' => {
- data_type => 'integer',
- },
- 'notes' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('liner_id');
-__PACKAGE__->belongs_to(
- 'cd', 'DBICTest::Schema::CD', 'liner_id'
-);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Link;
-
-use base qw/DBICTest::BaseResult/;
-
-use strict;
-use warnings;
-
-__PACKAGE__->table('link');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1
- },
- 'url' => {
- data_type => 'varchar',
- size => 100,
- is_nullable => 1,
- },
- 'title' => {
- data_type => 'varchar',
- size => 100,
- is_nullable => 1,
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-__PACKAGE__->has_many ( bookmarks => 'DBICTest::Schema::Bookmark', 'link', { cascade_delete => 0 } );
-
-use overload '""' => sub { shift->url }, fallback=> 1;
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::LyricVersion;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('lyric_versions');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'lyric_id' => {
- data_type => 'integer',
- is_foreign_key => 1,
- },
- 'text' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('id');
-__PACKAGE__->belongs_to('lyric', 'DBICTest::Schema::Lyrics', 'lyric_id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Lyrics;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('lyrics');
-__PACKAGE__->add_columns(
- 'lyric_id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'track_id' => {
- data_type => 'integer',
- is_foreign_key => 1,
- },
-);
-__PACKAGE__->set_primary_key('lyric_id');
-__PACKAGE__->belongs_to('track', 'DBICTest::Schema::Track', 'track_id');
-__PACKAGE__->has_many('lyric_versions', 'DBICTest::Schema::LyricVersion', 'lyric_id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Money;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('money_test');
-
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'amount' => {
- data_type => 'money',
- is_nullable => 1,
- },
-);
-
-__PACKAGE__->set_primary_key('id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::NoPrimaryKey;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('noprimarykey');
-__PACKAGE__->add_columns(
- 'foo' => { data_type => 'integer' },
- 'bar' => { data_type => 'integer' },
- 'baz' => { data_type => 'integer' },
-);
-
-__PACKAGE__->add_unique_constraint(foo_bar => [ qw/foo bar/ ]);
-
-1;
+++ /dev/null
-package DBICTest::Schema::NoSuchClass;
-
-## This is purposefully not a real DBIC class
-## Used in t/102load_classes.t
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::OneKey;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('onekey');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'artist' => {
- data_type => 'integer',
- },
- 'cd' => {
- data_type => 'integer',
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Owners;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('owners');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'name' => {
- data_type => 'varchar',
- size => '100',
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-__PACKAGE__->has_many(books => "DBICTest::Schema::BooksInLibrary", "owner");
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Producer;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('producer');
-__PACKAGE__->add_columns(
- 'producerid' => {
- data_type => 'integer',
- is_auto_increment => 1
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('producerid');
-__PACKAGE__->add_unique_constraint(prod_name => [ qw/name/ ]);
-
-__PACKAGE__->has_many(
- producer_to_cd => 'DBICTest::Schema::CD_to_Producer' => 'producer'
-);
-__PACKAGE__->many_to_many('cds', 'producer_to_cd', 'cd');
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::SelfRef;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('self_ref');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-__PACKAGE__->has_many( aliases => 'DBICTest::Schema::SelfRefAlias' => 'self_ref' );
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::SelfRefAlias;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('self_ref_alias');
-__PACKAGE__->add_columns(
- 'self_ref' => {
- data_type => 'integer',
- },
- 'alias' => {
- data_type => 'integer',
- },
-);
-__PACKAGE__->set_primary_key(qw/self_ref alias/);
-
-__PACKAGE__->belongs_to( self_ref => 'DBICTest::Schema::SelfRef' );
-__PACKAGE__->belongs_to( alias => 'DBICTest::Schema::SelfRef' );
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::SequenceTest;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('sequence_test');
-__PACKAGE__->source_info({
- "source_info_key_A" => "source_info_value_A",
- "source_info_key_B" => "source_info_value_B",
- "source_info_key_C" => "source_info_value_C",
- "source_info_key_D" => "source_info_value_D",
-});
-__PACKAGE__->add_columns(
- 'pkid1' => {
- data_type => 'integer',
- auto_nextval => 1,
- sequence => 'pkid1_seq',
- },
- 'pkid2' => {
- data_type => 'integer',
- auto_nextval => 1,
- sequence => 'pkid2_seq',
- },
- 'nonpkid' => {
- data_type => 'integer',
- auto_nextval => 1,
- sequence => 'nonpkid_seq',
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- is_nullable => 1,
- },
-);
-__PACKAGE__->set_primary_key('pkid1', 'pkid2');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Serialized;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('serialized');
-__PACKAGE__->add_columns(
- 'id' => { data_type => 'integer', is_auto_increment => 1 },
- 'serialized' => { data_type => 'text' },
-);
-__PACKAGE__->set_primary_key('id');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Tag;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('tags');
-__PACKAGE__->add_columns(
- 'tagid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'cd' => {
- data_type => 'integer',
- },
- 'tag' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('tagid');
-
-__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD' );
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Track;
-
-use base qw/DBICTest::BaseResult/;
-__PACKAGE__->load_components(qw/InflateColumn::DateTime Ordered/);
-
-__PACKAGE__->table('track');
-__PACKAGE__->add_columns(
- 'trackid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'cd' => {
- data_type => 'integer',
- },
- 'position' => {
- data_type => 'int',
- accessor => 'pos',
- },
- 'title' => {
- data_type => 'varchar',
- size => 100,
- },
- last_updated_on => {
- data_type => 'datetime',
- accessor => 'updated_date',
- is_nullable => 1
- },
- last_updated_at => {
- data_type => 'datetime',
- is_nullable => 1
- },
- small_dt => { # for mssql and sybase DT tests
- data_type => 'smalldatetime',
- is_nullable => 1
- },
-);
-__PACKAGE__->set_primary_key('trackid');
-
-__PACKAGE__->add_unique_constraint([ qw/cd position/ ]);
-__PACKAGE__->add_unique_constraint([ qw/cd title/ ]);
-
-__PACKAGE__->position_column ('position');
-__PACKAGE__->grouping_column ('cd');
-
-
-__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD' );
-__PACKAGE__->belongs_to( disc => 'DBICTest::Schema::CD' => 'cd');
-
-__PACKAGE__->might_have( cd_single => 'DBICTest::Schema::CD', 'single_track' );
-__PACKAGE__->might_have( lyrics => 'DBICTest::Schema::Lyrics', 'track_id' );
-
-__PACKAGE__->belongs_to(
- "year1999cd",
- "DBICTest::Schema::Year1999CDs",
- { "foreign.cdid" => "self.cd" },
- { join_type => 'left' }, # the relationship is of course optional
-);
-__PACKAGE__->belongs_to(
- "year2000cd",
- "DBICTest::Schema::Year2000CDs",
- { "foreign.cdid" => "self.cd" },
- { join_type => 'left' },
-);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::TreeLike;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('treelike');
-__PACKAGE__->add_columns(
- 'id' => { data_type => 'integer', is_auto_increment => 1 },
- 'parent' => { data_type => 'integer' , is_nullable=>1},
- 'name' => { data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key(qw/id/);
-__PACKAGE__->belongs_to('parent', 'TreeLike',
- { 'foreign.id' => 'self.parent' });
-__PACKAGE__->has_many('children', 'TreeLike', { 'foreign.parent' => 'self.id' });
-
-## since this is a self referential table we need to do a post deploy hook and get
-## some data in while constraints are off
-
- sub sqlt_deploy_hook {
- my ($self, $sqlt_table) = @_;
-
- ## We don't seem to need this anymore, but keeping it for the moment
- ## $sqlt_table->add_index(name => 'idx_name', fields => ['name']);
- }
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::TwoKeyTreeLike;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('twokeytreelike');
-__PACKAGE__->add_columns(
- 'id1' => { data_type => 'integer' },
- 'id2' => { data_type => 'integer' },
- 'parent1' => { data_type => 'integer' },
- 'parent2' => { data_type => 'integer' },
- 'name' => { data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key(qw/id1 id2/);
-__PACKAGE__->add_unique_constraint('tktlnameunique' => ['name']);
-__PACKAGE__->belongs_to('parent', 'DBICTest::Schema::TwoKeyTreeLike',
- { 'foreign.id1' => 'self.parent1', 'foreign.id2' => 'self.parent2'});
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::TwoKeys;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('twokeys');
-__PACKAGE__->add_columns(
- 'artist' => { data_type => 'integer' },
- 'cd' => { data_type => 'integer' },
-);
-__PACKAGE__->set_primary_key(qw/artist cd/);
-
-__PACKAGE__->belongs_to(
- artist => 'DBICTest::Schema::Artist',
- {'foreign.artistid'=>'self.artist'},
-);
-
-__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD', undef, { is_deferrable => 0, add_fk_index => 0 } );
-
-__PACKAGE__->has_many(
- 'fourkeys_to_twokeys', 'DBICTest::Schema::FourKeys_to_TwoKeys', {
- 'foreign.t_artist' => 'self.artist',
- 'foreign.t_cd' => 'self.cd',
-});
-
-__PACKAGE__->many_to_many(
- 'fourkeys', 'fourkeys_to_twokeys', 'fourkeys',
-);
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::TypedObject;
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table('typed_object');
-__PACKAGE__->add_columns(
- 'objectid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'type' => {
- data_type => 'varchar',
- size => '100',
- },
- 'value' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('objectid');
-
-__PACKAGE__->has_many( collection_object => "DBICTest::Schema::CollectionObject",
- { "foreign.object" => "self.objectid" }
- );
-__PACKAGE__->many_to_many( collections => collection_object => "collection" );
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Year1999CDs;
-## Used in 104view.t
-
-use base qw/DBICTest::BaseResult/;
-
-__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
-
-__PACKAGE__->table('year1999cds');
-__PACKAGE__->result_source_instance->is_virtual(1);
-__PACKAGE__->result_source_instance->view_definition(
- "SELECT cdid, artist, title, single_track FROM cd WHERE year ='1999'"
-);
-__PACKAGE__->add_columns(
- 'cdid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'artist' => {
- data_type => 'integer',
- },
- 'title' => {
- data_type => 'varchar',
- size => 100,
- },
- 'single_track' => {
- data_type => 'integer',
- is_nullable => 1,
- is_foreign_key => 1,
- },
-);
-__PACKAGE__->set_primary_key('cdid');
-__PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
-
-__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist' );
-__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track',
- { "foreign.cd" => "self.cdid" });
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Schema::Year2000CDs;
-
-use base qw/DBICTest::Schema::CD/;
-
-__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
-__PACKAGE__->table('year2000cds');
-
-# need to operate on the instance for things to work
-__PACKAGE__->result_source_instance->view_definition( sprintf (
- 'SELECT %s FROM cd WHERE year = "2000"',
- join (', ', __PACKAGE__->columns),
-));
-
-__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist' );
-__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track',
- { "foreign.cd" => "self.cdid" });
-
-1;
+++ /dev/null
-package DBICTest::Stats;
-use strict;
-use warnings;
-
-use base qw/DBIx::Class::Storage::Statistics/;
-
-sub txn_begin {
- my $self = shift;
-
- $self->{'TXN_BEGIN'}++;
- return $self->{'TXN_BEGIN'};
-}
-
-sub txn_rollback {
- my $self = shift;
-
- $self->{'TXN_ROLLBACK'}++;
- return $self->{'TXN_ROLLBACK'};
-}
-
-sub txn_commit {
- my $self = shift;
-
- $self->{'TXN_COMMIT'}++;
- return $self->{'TXN_COMMIT'};
-}
-
-sub svp_begin {
- my ($self, $name) = @_;
-
- $self->{'SVP_BEGIN'}++;
- return $self->{'SVP_BEGIN'};
-}
-
-sub svp_release {
- my ($self, $name) = @_;
-
- $self->{'SVP_RELEASE'}++;
- return $self->{'SVP_RELEASE'};
-}
-
-sub svp_rollback {
- my ($self, $name) = @_;
-
- $self->{'SVP_ROLLBACK'}++;
- return $self->{'SVP_ROLLBACK'};
-}
-
-sub query_start {
- my ($self, $string, @bind) = @_;
-
- $self->{'QUERY_START'}++;
- return $self->{'QUERY_START'};
-}
-
-sub query_end {
- my ($self, $string) = @_;
-
- $self->{'QUERY_END'}++;
- return $self->{'QUERY_START'};
-}
-
-1;
+++ /dev/null
-# belongs to t/run/90ensure_class_loaded.tl
-package # hide from PAUSE
- DBICTest::SyntaxErrorComponent1;
-use warnings;
-use strict;
-
-my $str ''; # syntax error
-
-1;
+++ /dev/null
-# belongs to t/run/90ensure_class_loaded.tl
-package # hide from PAUSE
- DBICTest::SyntaxErrorComponent2;
-use warnings;
-use strict;
-
-my $str ''; # syntax error
-
-1;
+++ /dev/null
-package DBICErrorTest::SyntaxError;
-
-use strict;
-
-I'm a syntax error!
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Taint::Classes::Auto;
-
-use base 'DBIx::Class::Core';
-__PACKAGE__->table('test');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Taint::Classes::Manual;
-
-use base 'DBIx::Class::Core';
-__PACKAGE__->table('test');
-
-1;
+++ /dev/null
-package # hide from PAUSE
- DBICTest::Taint::Namespaces::Result::Test;
-
-use base 'DBIx::Class::Core';
-__PACKAGE__->table('test');
-
-1;