--- /dev/null
+use strict;
+use warnings;
+use lib 't/lib';
+use Test::More qw(no_plan);
+use Test::Exception;
+use Devel::Dwarn;
+
+BEGIN {
+ use_ok 'NoSequence';
+ $ENV{DBIC_TRACE} = 0;
+}
+
+my $schema = NoSequence->connect( 'dbi:Pg:dbname=test', 'postgres', '' );
+$schema->storage->dbh->{Warn} = 0;
+$schema->storage->ensure_connected;
+$schema->storage->_use_insert_returning(0);
+
+my $dir = "t/sql"; # tempdir(CLEANUP => 0);
+$schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir );
+$schema->deploy( { add_drop_table => 1, add_drop_view => 1 } );
+
+isa_ok(
+ $schema->source('Mesclun'),
+ 'DBIx::Class::ResultSource::View',
+ "My MTI class also"
+);
+
+my ( $bowl_of_salad, $bowl_of_salad1 );
+
+lives_ok {
+ $bowl_of_salad = $schema->resultset('Mesclun')
+ ->create( { acidity => 4, spiciness => '10', fresh => 0 } );
+}
+"I can call a create on a view mesclun";
+
+lives_ok {
+ $bowl_of_salad1 = $schema->resultset('Salad')->create( { fresh => 1 } );
+}
+"I can do it for the other view, too";
+
+
__PACKAGE__->table_class(MTI);
__PACKAGE__->table('coffee');
__PACKAGE__->add_columns(
- "id", { data_type => "integer", is_auto_increment => 1},
+ "id", { data_type => "integer", is_auto_increment => 1, sequence => '_coffee_id_seq'},
"flavor", { data_type => "text", default_value => "good" },
);
--- /dev/null
+package NoSequence;
+
+use strict;
+use warnings;
+use parent 'DBIx::Class::Schema';
+use aliased 'DBIx::Class::ResultSource::MultipleTableInheritance' => 'MTIView';
+
+for my $p (__PACKAGE__) {
+ $p->load_namespaces;
+ $_->attach_additional_sources
+ for grep $_->isa(MTIView), map $p->source($_), $p->sources;
+}
+
+1;
--- /dev/null
+package NoSequence::Result::Dressing;
+
+use strict;
+use warnings;
+use parent 'DBIx::Class::Core';
+
+__PACKAGE__->table('dressing');
+
+__PACKAGE__->add_columns(
+ id => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ },
+ acidity => { data_type => 'integer', default => '2' }
+);
+
+__PACKAGE__->set_primary_key('id');
+
+1;
--- /dev/null
+package NoSequence::Result::Mesclun;
+
+use strict;
+use warnings;
+use parent 'NoSequence::Result::Salad';
+
+require NoSequence::Result::Dressing;
+
+__PACKAGE__->table('mesclun');
+__PACKAGE__->result_source_instance->add_additional_parent(
+ NoSequence::Result::Dressing->result_source_instance );
+__PACKAGE__->add_columns( "spiciness", { data_type => "integer" } );
+
+1;
--- /dev/null
+package NoSequence::Result::Salad;
+
+use strict;
+use warnings;
+use parent 'DBIx::Class::Core';
+use aliased 'DBIx::Class::ResultSource::MultipleTableInheritance' => 'MTI';
+
+__PACKAGE__->table_class(MTI);
+__PACKAGE__->table('salad');
+__PACKAGE__->add_columns(
+ "id", { data_type => "integer", is_auto_increment => 1 },
+ "fresh", { data_type => "boolean", },
+);
+
+__PACKAGE__->set_primary_key("id");
+
+1;