[Bast-commits] r4300 - in
branches/DBIx-Class-Schema-Loader/current: .
lib/DBIx/Class/Schema/Loader t/lib
ilmari at dev.catalyst.perl.org
ilmari at dev.catalyst.perl.org
Fri Apr 25 23:54:54 BST 2008
Author: ilmari
Date: 2008-04-25 23:54:54 +0100 (Fri, 25 Apr 2008)
New Revision: 4300
Modified:
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/t/lib/dbixcsl_common_tests.pm
Log:
Singularise table monikers by default
Modified: branches/DBIx-Class-Schema-Loader/current/Changes
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/Changes 2008-04-25 22:33:29 UTC (rev 4299)
+++ branches/DBIx-Class-Schema-Loader/current/Changes 2008-04-25 22:54:54 UTC (rev 4300)
@@ -1,5 +1,8 @@
Revision history for Perl extension DBIx::Class::Schema::Loader
+0.04999_06 Not Yet Released
+ - Singularise table monikers by default
+
0.04999_05 Mon Apr 14, 2008
- Fix limiting table list to the specified schema for DB2
- Default db_schema to the username for DB2
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 2008-04-25 22:33:29 UTC (rev 4299)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2008-04-25 22:54:54 UTC (rev 4300)
@@ -12,6 +12,7 @@
use File::Spec qw//;
use Cwd qw//;
use Digest::MD5 qw//;
+use Lingua::EN::Inflect::Number qw//;
require DBIx::Class;
our $VERSION = '0.04999_05';
@@ -706,7 +707,8 @@
$moniker = $self->moniker_map->($table);
}
- $moniker ||= join '', map ucfirst, split /[\W_]+/, lc $table;
+ $moniker ||= join '', map ucfirst, split /[\W_]+/,
+ Lingua::EN::Inflect::Number::to_S(lc $table);
return $moniker;
}
Modified: branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_common_tests.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_common_tests.pm 2008-04-25 22:33:29 UTC (rev 4299)
+++ branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_common_tests.pm 2008-04-25 22:54:54 UTC (rev 4300)
@@ -51,7 +51,7 @@
sub run_tests {
my $self = shift;
- plan tests => 3 + 2 * (131 + ($self->{extra}->{count} || 0));
+ plan tests => 3 + 2 * (132 + ($self->{extra}->{count} || 0));
$self->create();
@@ -81,7 +81,7 @@
my $debug = ($self->{verbose} > 1) ? 1 : 0;
my %loader_opts = (
- constraint => qr/^(?:\S+\.)?(?:$self->{vendor}_)?loader_test[0-9]+$/i,
+ constraint => qr/^(?:\S+\.)?(?:$self->{vendor}_)?loader_test[0-9]+s?$/i,
relationships => 1,
additional_classes => 'TestAdditional',
additional_base_classes => 'TestAdditionalBase',
@@ -140,8 +140,8 @@
$classes->{$table_name} = $schema_class . q{::} . $source_name;
}
- my $moniker1 = $monikers->{loader_test1};
- my $class1 = $classes->{loader_test1};
+ my $moniker1 = $monikers->{loader_test1s};
+ my $class1 = $classes->{loader_test1s};
my $rsobj1 = $conn->resultset($moniker1);
my $moniker2 = $monikers->{loader_test2};
@@ -175,6 +175,8 @@
}
ok($uniq1_test, "Unique constraint");
+ is($moniker1, 'LoaderTest1', 'moniker singularisation');
+
my %uniq2 = $class2->unique_constraints;
my $uniq2_test = 0;
foreach my $ucname (keys %uniq2) {
@@ -668,16 +670,16 @@
my $make_auto_inc = $self->{auto_inc_cb} || sub {};
my @statements = (
qq{
- CREATE TABLE loader_test1 (
+ CREATE TABLE loader_test1s (
id $self->{auto_inc_pk},
dat VARCHAR(32) NOT NULL UNIQUE
) $self->{innodb}
},
- $make_auto_inc->(qw/loader_test1 id/),
+ $make_auto_inc->(qw/loader_test1s id/),
- q{ INSERT INTO loader_test1 (dat) VALUES('foo') },
- q{ INSERT INTO loader_test1 (dat) VALUES('bar') },
- q{ INSERT INTO loader_test1 (dat) VALUES('baz') },
+ q{ INSERT INTO loader_test1s (dat) VALUES('foo') },
+ q{ INSERT INTO loader_test1s (dat) VALUES('bar') },
+ q{ INSERT INTO loader_test1s (dat) VALUES('baz') },
qq{
CREATE TABLE loader_test2 (
@@ -1073,14 +1075,14 @@
my $self = shift;
my @tables = qw/
- loader_test1
+ loader_test1s
loader_test2
LOADER_TEST23
LoAdEr_test24
/;
my @tables_auto_inc = (
- [ qw/loader_test1 id/ ],
+ [ qw/loader_test1s id/ ],
[ qw/loader_test2 id/ ],
);
More information about the Bast-commits
mailing list