New, failing SQLT deployment order test.
Amiri Barksdale at Home [Wed, 29 Dec 2010 15:50:43 +0000 (07:50 -0800)]
The order of the views is not being set properly because one keeps
depending on itself. Still code-diving to find out why. The Cafe schema
works, and I don't see the difference yet.

t/02view_def.t
t/lib/CafeInsertion/Result/Chair.pm [new file with mode: 0644]
t/lib/CafeInsertion/Result/Coffee.pm
t/lib/CafeInsertion/Result/Sugar.pm
t/lib/CafeInsertion/Result/Sumatra.pm
t/lib/LoadTest/Result/Bar.pm
t/lib/LoadTest/Result/Foo.pm
t/lib/LoadTest/Result/Mixin.pm

index 19cfc59..4b5d2c9 100644 (file)
@@ -23,6 +23,7 @@ dies_ok { LoadTest->source('Foo')->view_definition }
 "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);
 
@@ -33,6 +34,12 @@ lives_ok {
 }
 "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(
diff --git a/t/lib/CafeInsertion/Result/Chair.pm b/t/lib/CafeInsertion/Result/Chair.pm
new file mode 100644 (file)
index 0000000..cd06d35
--- /dev/null
@@ -0,0 +1,22 @@
+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;
index 625c949..0dc65b0 100644 (file)
@@ -1,5 +1,5 @@
-package # hide from PAUSE
-       CafeInsertion::Result::Coffee;
+package    # hide from PAUSE
+    CafeInsertion::Result::Coffee;
 
 use strict;
 use warnings;
@@ -9,8 +9,13 @@ use aliased 'DBIx::Class::ResultSource::MultipleTableInheritance' => 'MTI';
 __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");
index 31001ae..a7b9304 100644 (file)
@@ -1,5 +1,5 @@
-package # hide from PAUSE
-       CafeInsertion::Result::Sugar;
+package    # hide from PAUSE
+    CafeInsertion::Result::Sugar;
 
 use strict;
 use warnings;
index 04403fa..3c6c7b7 100644 (file)
@@ -1,5 +1,5 @@
-package # hide from PAUSE
-       CafeInsertion::Result::Sumatra;
+package    # hide from PAUSE
+    CafeInsertion::Result::Sumatra;
 
 use strict;
 use warnings;
@@ -8,11 +8,14 @@ use parent 'CafeInsertion::Result::Coffee';
 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;
index ed6a506..e236be3 100644 (file)
@@ -1,5 +1,5 @@
-package # hide from PAUSE
-       LoadTest::Result::Bar;
+package    # hide from PAUSE
+    LoadTest::Result::Bar;
 
 use strict;
 use warnings;
@@ -9,24 +9,18 @@ require LoadTest::Result::Mixin;
 
 __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;
index 7b20e1b..a8680ae 100644 (file)
@@ -1,26 +1,22 @@
-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;
index 95a9007..10eb205 100644 (file)
@@ -1,17 +1,19 @@
-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');