[Catalyst-commits] r9365 - in trunk/Catalyst-Model-DBIC-Schema: .
lib/Catalyst/Helper/Model/DBIC lib/Catalyst/Model/DBIC
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Fri Feb 20 16:12:49 GMT 2009
Author: caelum
Date: 2009-02-20 16:12:49 +0000 (Fri, 20 Feb 2009)
New Revision: 9365
Modified:
trunk/Catalyst-Model-DBIC-Schema/Makefile.PL
trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm
trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm
Log:
C::M::DBIC::Schema -- better defaults for create=static, with backcompat
Modified: trunk/Catalyst-Model-DBIC-Schema/Makefile.PL
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/Makefile.PL 2009-02-20 15:17:36 UTC (rev 9364)
+++ trunk/Catalyst-Model-DBIC-Schema/Makefile.PL 2009-02-20 16:12:49 UTC (rev 9365)
@@ -13,7 +13,7 @@
feature 'Catalyst::Helper support',
-default => 0,
'Catalyst::Devel' => '1.0',
- 'DBIx::Class::Schema::Loader' => '0.03012';
+ 'DBIx::Class::Schema::Loader' => '0.04005';
if(-e 'MANIFEST.SKIP') {
system("pod2text lib/Catalyst/Model/DBIC/Schema.pm > README");
Modified: trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm 2009-02-20 15:17:36 UTC (rev 9364)
+++ trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm 2009-02-20 16:12:49 UTC (rev 9365)
@@ -122,11 +122,35 @@
$num++;
}
- make_schema_at(
- $schema_class,
- { relationships => 1 },
- \@loader_connect_info,
- );
+# Check if we need to be backward-compatible.
+ my $compatible = 0;
+
+ my @schema_pm = split '::', $schema_class;
+ $schema_pm[-1] .= '.pm';
+ my $schema_file = File::Spec->catfile($helper->{base}, 'lib', @schema_pm);
+
+ if (-f $schema_file) {
+ my $schema_code = do { local (@ARGV, $/) = $schema_file; <> };
+ $compatible = 1 if $schema_code =~ /->load_classes/;
+ }
+
+ if ($compatible) {
+ make_schema_at(
+ $schema_class,
+ { relationships => 1 },
+ \@loader_connect_info,
+ );
+ } else { # use some saner defaults
+ make_schema_at(
+ $schema_class,
+ {
+ relationships => 1,
+ use_namespaces => 1,
+ components => ['InflateColumn::DateTime']
+ },
+ \@loader_connect_info,
+ );
+ }
}
my $file = $helper->{file};
Modified: trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm 2009-02-20 15:17:36 UTC (rev 9364)
+++ trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm 2009-02-20 16:12:49 UTC (rev 9365)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.22';
+our $VERSION = '0.23';
use base qw/Catalyst::Model Class::Accessor::Fast Class::Data::Accessor/;
use NEXT;
More information about the Catalyst-commits
mailing list