[Bast-commits] r5899 - in
branches/DBIx-Class-Schema-Loader/current: .
lib/DBIx/Class/Schema/Loader
ilmari at dev.catalyst.perl.org
ilmari at dev.catalyst.perl.org
Sat Apr 18 11:06:25 GMT 2009
Author: ilmari
Date: 2009-04-18 12:06:25 +0100 (Sat, 18 Apr 2009)
New Revision: 5899
Modified:
branches/DBIx-Class-Schema-Loader/current/Changes
branches/DBIx-Class-Schema-Loader/current/TODO
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
Log:
Fix for DBIx::Class 0.08100
* Pass the schema object to RelBuilder, not the class
* Fix result and resultsource class reloading
Modified: branches/DBIx-Class-Schema-Loader/current/Changes
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/Changes 2009-04-18 11:06:20 UTC (rev 5898)
+++ branches/DBIx-Class-Schema-Loader/current/Changes 2009-04-18 11:06:25 UTC (rev 5899)
@@ -4,6 +4,7 @@
- Add result_base_class and schema_base_class options (RT #43977)
- Ignore duplicate uniq indices (including duplicates of the PK).
- Fix for DBD::SQLite 1.20
+ - Fix for DBIx::Class 0.08100
0.04999_06 Tue Nov 11, 2008
- Singularise table monikers by default
Modified: branches/DBIx-Class-Schema-Loader/current/TODO
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/TODO 2009-04-18 11:06:20 UTC (rev 5898)
+++ branches/DBIx-Class-Schema-Loader/current/TODO 2009-04-18 11:06:25 UTC (rev 5899)
@@ -1,8 +1,6 @@
0.05 BLOCKERS
=============
-Fix failures with DBIC trunk
-
Add backwards-compatibility mode when regenerating a 0.04-generated schema
OTHER STUFF
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-04-18 11:06:20 UTC (rev 5898)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2009-04-18 11:06:25 UTC (rev 5899)
@@ -5,7 +5,6 @@
use base qw/Class::Accessor::Fast/;
use Class::C3;
use Carp::Clan qw/^DBIx::Class/;
-use UNIVERSAL::require;
use DBIx::Class::Schema::Loader::RelBuilder;
use Data::Dump qw/ dump /;
use POSIX qw//;
@@ -272,7 +271,7 @@
);
$self->{relbuilder} = DBIx::Class::Schema::Loader::RelBuilder->new(
- $self->schema_class, $self->inflect_plural, $self->inflect_singular
+ $self->schema, $self->inflect_plural, $self->inflect_singular
) if !$self->{skip_relationships};
$self;
@@ -361,6 +360,7 @@
my ($self, $schema) = @_;
$self->{schema} = $schema;
+ $self->{relbuilder}{schema} = $schema;
my @created;
my @current = $self->_tables_list;
@@ -421,6 +421,10 @@
unshift @INC, $self->dump_directory;
+ my @to_register;
+ my %have_source = map { $_ => $self->schema->source($_) }
+ $self->schema->sources;
+
for my $table (@tables) {
my $moniker = $self->monikers->{$table};
my $class = $self->classes->{$table};
@@ -430,17 +434,25 @@
local *Class::C3::reinitialize = sub {};
use warnings;
- if ( Class::Unload->unload( $class ) ) {
- my $resultset_class = ref $self->schema->resultset($moniker);
- Class::Unload->unload( $resultset_class )
- if $resultset_class ne 'DBIx::Class::ResultSet';
+ Class::Unload->unload($class);
+ my ($source, $resultset_class);
+ if (
+ ($source = $have_source{$moniker})
+ && ($resultset_class = $source->resultset_class)
+ && ($resultset_class ne 'DBIx::Class::ResultSet')
+ ) {
+ my $has_file = Class::Inspector->loaded_filename($resultset_class);
+ Class::Unload->unload($resultset_class);
+ $self->schema->ensure_class_loaded($resultset_class) if $has_file;
}
- $class->require or die "Can't load $class: $@";
+ $self->schema->ensure_class_loaded($class);
}
+ push @to_register, [$moniker, $class];
+ }
- $self->schema_class->register_class($moniker, $class);
- $self->schema->register_class($moniker, $class)
- if $self->schema ne $self->schema_class;
+ Class::C3->reinitialize;
+ for (@to_register) {
+ $self->schema->register_class(@$_);
}
}
More information about the Bast-commits
mailing list