[Bast-commits] r5731 - in
branches/DBIx-Class-Schema-Loader/current: .
lib/DBIx/Class/Schema/Loader lib/DBIx/Class/Schema/Loader/DBI t
ilmari at dev.catalyst.perl.org
ilmari at dev.catalyst.perl.org
Tue Mar 10 12:37:47 GMT 2009
Author: ilmari
Date: 2009-03-10 12:37:47 +0000 (Tue, 10 Mar 2009)
New Revision: 5731
Modified:
branches/DBIx-Class-Schema-Loader/current/
branches/DBIx-Class-Schema-Loader/current/Changes
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm
branches/DBIx-Class-Schema-Loader/current/t/04kwalitee.t
branches/DBIx-Class-Schema-Loader/current/t/23dumpmore.t
Log:
r27903 at fenchurch (orig r4475): ilmari | 2008-06-08 14:18:48 +0100
Fix Oracle constraint detection for non-owned schemas
r37690 at fenchurch (orig r5722): timbunce | 2009-03-09 21:02:02 +0000
Implement result_base_class and schema_base_class options.
r37693 at fenchurch (orig r5725): timbunce | 2009-03-09 21:36:21 +0000
Fix test plan count in t/23dumpmore.t and add Change note missed from r5722
r37694 at fenchurch (orig r5726): timbunce | 2009-03-09 21:40:30 +0000
Reduce noise when running tests if Test::Kwalitee isn't installed.
Property changes on: branches/DBIx-Class-Schema-Loader/current
___________________________________________________________________
Name: svk:merge
- 46bc3436-8211-0410-8564-d96f7a728040:/local/DBIx-Class-Schema-Loader/branches/common-dump:37173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class-Schema-Loader:4266
+ 46bc3436-8211-0410-8564-d96f7a728040:/local/DBIx-Class-Schema-Loader/branches/common-dump:37173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class-Schema-Loader:5726
Modified: branches/DBIx-Class-Schema-Loader/current/Changes
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/Changes 2009-03-10 12:22:53 UTC (rev 5730)
+++ branches/DBIx-Class-Schema-Loader/current/Changes 2009-03-10 12:37:47 UTC (rev 5731)
@@ -1,5 +1,8 @@
Revision history for Perl extension DBIx::Class::Schema::Loader
+0.04999_07 Not Yet Released
+ - Add result_base_class and schema_base_class options (RT #43977)
+
0.04999_06 Tue Nov 11, 2008
- Singularise table monikers by default
- Strip trailing _id from single-column belongs_to relationships
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2009-03-10 12:22:53 UTC (rev 5730)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2009-03-10 12:37:47 UTC (rev 5731)
@@ -42,6 +42,8 @@
result_namespace
resultset_namespace
default_resultset_class
+ schema_base_class
+ result_base_class
db_schema
_tables
@@ -123,6 +125,14 @@
As L</inflect_plural> above, but for singularizing relationship names.
Default behavior is to utilize L<Lingua::EN::Inflect::Number/to_S>.
+=head2 schema_base_class
+
+Base class for your schema classes. Defaults to 'DBIx::Class::Schema'.
+
+=head2 result_base_class
+
+Base class for your table classes (aka result classes). Defaults to 'DBIx::Class'.
+
=head2 additional_base_classes
List of additional base classes all of your table classes will use.
@@ -462,6 +472,7 @@
my $target_dir = $self->dump_directory;
my $schema_class = $self->schema_class;
+ my $schema_base_class = $self->schema_base_class || 'DBIx::Class::Schema';
warn "Dumping manual schema for $schema_class to directory $target_dir ...\n"
unless $self->{dynamic} or $self->{quiet};
@@ -469,7 +480,7 @@
my $schema_text =
qq|package $schema_class;\n\n|
. qq|use strict;\nuse warnings;\n\n|
- . qq|use base 'DBIx::Class::Schema';\n\n|;
+ . qq|use base '$schema_base_class';\n\n|;
if ($self->use_namespaces) {
@@ -492,11 +503,13 @@
$self->_write_classfile($schema_class, $schema_text);
+ my $result_base_class = $self->result_base_class || 'DBIx::Class';
+
foreach my $src_class (@classes) {
my $src_text =
qq|package $src_class;\n\n|
. qq|use strict;\nuse warnings;\n\n|
- . qq|use base 'DBIx::Class';\n\n|;
+ . qq|use base '$result_base_class';\n\n|;
$self->_write_classfile($src_class, $src_text);
}
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm
===================================================================
Modified: branches/DBIx-Class-Schema-Loader/current/t/04kwalitee.t
===================================================================
Modified: branches/DBIx-Class-Schema-Loader/current/t/23dumpmore.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/23dumpmore.t 2009-03-10 12:22:53 UTC (rev 5730)
+++ branches/DBIx-Class-Schema-Loader/current/t/23dumpmore.t 2009-03-10 12:37:47 UTC (rev 5731)
@@ -8,7 +8,7 @@
$^O eq 'MSWin32'
? plan(skip_all => "ActiveState perl produces additional warnings, and this test uses unix paths")
- : plan(tests => 140);
+ : plan(tests => 143);
my $DUMP_PATH = './t/_dump';
@@ -276,6 +276,8 @@
result_namespace => '+DBICTest::DumpMore::1::Res',
resultset_namespace => 'RSet',
default_resultset_class => 'RSetBase',
+ result_base_class => 'My::ResultBaseClass',
+ schema_base_class => 'My::SchemaBaseClass',
},
error => '',
warnings => [
@@ -289,14 +291,17 @@
qr/result_namespace => '\+DBICTest::DumpMore::1::Res'/,
qr/resultset_namespace => 'RSet'/,
qr/default_resultset_class => 'RSetBase'/,
+ qr/use base 'My::SchemaBaseClass'/,
],
'Res/Foo' => [
qr/package DBICTest::DumpMore::1::Res::Foo;/,
+ qr/use base 'My::ResultBaseClass'/,
qr/->set_primary_key/,
qr/1;\n$/,
],
'Res/Bar' => [
qr/package DBICTest::DumpMore::1::Res::Bar;/,
+ qr/use base 'My::ResultBaseClass'/,
qr/->set_primary_key/,
qr/1;\n$/,
],
More information about the Bast-commits
mailing list