- might_have/has_one now warn if applied calling class's column
has is_nullable set to true.
- Cookbook POD fix for add_drop_table instead of add_drop_tables
+ - Views without a view_definition will throw an exception when
+ parsed by SQL::Translator::Parser::DBIx::Class
0.08115 2009-12-10 09:02:00 (CST)
- Real limit/offset support for MSSQL server (via Row_Number)
# Its possible to have multiple DBIC source using same table
next if $views{$view_name}++;
+ $dbicschema->throw_exception ("view $view_name is missing a view_definition")
+ unless $source->view_definition;
+
my $view = $schema->add_view (
name => $view_name,
fields => [ $source->columns ],
use strict;
use warnings;
use Test::More;
+use Test::Exception;
use lib qw(t/lib);
use DBICTest;
}
}
+{
+ {
+ package # hide from PAUSE
+ DBICTest::Schema::NoViewDefinition;
+
+ use base qw/DBICTest::BaseResult/;
+
+ __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
+ __PACKAGE__->table('noviewdefinition');
+
+ 1;
+ }
+
+ my $schema_invalid_view = $schema->clone;
+ $schema_invalid_view->register_class('NoViewDefinition', 'DBICTest::Schema::NoViewDefinition');
+
+ throws_ok { create_schema({ schema => $schema_invalid_view }) }
+ qr/view noviewdefinition is missing a view_definition/,
+ 'parser detects views with a view_definition';
+}
+
done_testing;
sub create_schema {
my $sqlt = SQL::Translator->new( $sqltargs );
$sqlt->parser('SQL::Translator::Parser::DBIx::Class');
- return $sqlt->translate({ data => $schema }) or die $sqlt->error;
+ return $sqlt->translate({ data => $schema }) || die $sqlt->error;
}
sub get_table {