"Can't generate view def without connected schema";
my $schema = LoadTest->connect( $dsn, $user, $pass );
+$schema->storage->ensure_connected;
my $dir = "t/sql"; # tempdir(CLEANUP => 0);
}
"It's also OK to deploy the schema";
+isa_ok(
+ $schema->source('Bar'),
+ 'DBIx::Class::ResultSource::View',
+ "My MTI class also"
+);
+
my $sqlt_object = $schema->{sqlt};
is_deeply(
--- /dev/null
+package # hide from PAUSE
+ CafeInsertion::Result::Chair;
+
+use base qw(DBIx::Class::Core);
+
+__PACKAGE__->table('chair');
+
+__PACKAGE__->add_columns(
+ id => { data_type => 'integer', is_auto_increment => 1 },
+ name => { data_type => 'varchar', size => 255 }
+);
+
+__PACKAGE__->set_primary_key('id');
+
+__PACKAGE__->has_many(
+ 'coffees',
+ 'CafeInsertion::Result::Coffee',
+ { 'foreign.id' => 'self.id' }
+);
+
+
+1;
-package # hide from PAUSE
- CafeInsertion::Result::Coffee;
+package # hide from PAUSE
+ CafeInsertion::Result::Coffee;
use strict;
use warnings;
__PACKAGE__->table_class(MTI);
__PACKAGE__->table('coffee');
__PACKAGE__->add_columns(
- "id", { data_type => "integer", is_auto_increment => 1, sequence => '_coffee_id_seq'},
- "flavor", { data_type => "text", default_value => "good" },
+ "id",
+ { data_type => "integer",
+ is_auto_increment => 1,
+ sequence => '_coffee_id_seq'
+ },
+ "flavor",
+ { data_type => "text", default_value => "good" },
);
__PACKAGE__->set_primary_key("id");
-package # hide from PAUSE
- CafeInsertion::Result::Sugar;
+package # hide from PAUSE
+ CafeInsertion::Result::Sugar;
use strict;
use warnings;
-package # hide from PAUSE
- CafeInsertion::Result::Sumatra;
+package # hide from PAUSE
+ CafeInsertion::Result::Sumatra;
use strict;
use warnings;
require CafeInsertion::Result::Sugar;
__PACKAGE__->table('sumatra');
-__PACKAGE__->result_source_instance->add_additional_parent(
- CafeInsertion::Result::Sugar->result_source_instance );
+__PACKAGE__->result_source_instance->add_additional_parents(
+ "CafeInsertion::Result::Sugar");
__PACKAGE__->add_columns( "aroma", { data_type => "text" } );
-#__PACKAGE__->has_many( 'coffees', 'CafeInsertion::Result::Coffee',
-#{ 'foreign.id' => 'self.id' } );
+__PACKAGE__->has_many(
+ 'coffees',
+ 'CafeInsertion::Result::Coffee',
+ { 'foreign.id' => 'self.id' }
+);
1;
-package # hide from PAUSE
- LoadTest::Result::Bar;
+package # hide from PAUSE
+ LoadTest::Result::Bar;
use strict;
use warnings;
__PACKAGE__->table('bar');
-__PACKAGE__->result_source_instance->add_additional_parent(
- LoadTest::Result::Mixin->result_source_instance
-);
+__PACKAGE__->result_source_instance->add_additional_parents(
+ "LoadTest::Result::Mixin" );
+
+__PACKAGE__->add_columns( b => { data_type => 'integer' } );
-__PACKAGE__->add_columns(
- b => { data_type => 'integer' }
+__PACKAGE__->belongs_to(
+ 'b_thang',
+ 'LoadTest::Result::JustATable',
+ { 'foreign.id' => 'self.b' },
);
-#__PACKAGE__->belongs_to(
- #'b_thang',
- #'LoadTest::Result::JustATable',
- #{ 'foreign.id' => 'self.b' },
-#);
-
-#__PACKAGE__->has_many(
- #'foos',
- #'LoadTest::Result::Foo',
- #{ 'foreign.a' => 'self.id' }
-#);
+__PACKAGE__->has_many( 'foos', 'LoadTest::Result::Foo',
+ { 'foreign.a' => 'self.id' } );
1;
-package # hide from PAUSE
- LoadTest::Result::Foo;
+package # hide from PAUSE
+ LoadTest::Result::Foo;
use strict;
use warnings;
-use parent qw(DBIx::Class::Core);
-use aliased 'DBIx::Class::ResultSource::MultipleTableInheritance';
-
-__PACKAGE__->table_class(MultipleTableInheritance);
+use parent 'DBIx::Class::Core';
+use aliased 'DBIx::Class::ResultSource::MultipleTableInheritance' => 'MTI';
+__PACKAGE__->table_class(MTI);
__PACKAGE__->table('foo');
__PACKAGE__->add_columns(
- id => { data_type => 'integer', is_auto_increment => 1 },
- a => { data_type => 'integer', is_nullable => 1 }
+ id => { data_type => 'integer', is_auto_increment => 1 },
+ a => { data_type => 'integer', is_nullable => 1 }
);
__PACKAGE__->set_primary_key('id');
-#__PACKAGE__->belongs_to(
- #'bar',
- #'LoadTest::Result::Bar',
- #{ 'foreign.id' => 'self.a' }
-#);
+__PACKAGE__->belongs_to( 'bar', 'LoadTest::Result::Bar',
+ { 'foreign.id' => 'self.a' } );
1;
-package # hide from PAUSE
- LoadTest::Result::Mixin;
+package # hide from PAUSE
+ LoadTest::Result::Mixin;
use strict;
use warnings;
-use parent qw(DBIx::Class::Core);
+use parent 'DBIx::Class::Core';
__PACKAGE__->table('mixin');
__PACKAGE__->add_columns(
- id => {
- data_type => 'integer', is_auto_increment => 1, sequence => 'foo_id_seq'
- },
- words => { data_type => 'text' }
+ id => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ sequence => 'foo_id_seq'
+ },
+ words => { data_type => 'text' }
);
__PACKAGE__->set_primary_key('id');