From: Brandon Black Date: Wed, 28 Jun 2006 04:36:24 +0000 (+0000) Subject: version bump to 0.03004 X-Git-Tag: 0.03004~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a13b280367c1e372e5dbc00862c92751082a9fc2;p=dbsrgits%2FDBIx-Class-Schema-Loader.git version bump to 0.03004 columns_info_for gets dumped out now minor test fix, minor source cleanups TODO additions --- diff --git a/TODO b/TODO index 7a7439f..a72f233 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,9 @@ -dump_to_dir needs an overwrite flag, and needs to not overwrite by default +support multiple/all schemas, instead of just one + +support pk/uk/fk info on views, possibly. May or may not be a sane thing to try to do. -dumping needs to pick up columns_info_for data +dump_to_dir needs an overwrite flag, and needs to not overwrite by default Fix up ResultSet Manager / Methods / etc stuff. May require some work in the main DBIx::Class first. diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index 0a17552..cb4c8bf 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -13,7 +13,7 @@ use Scalar::Util qw/ weaken /; # Always remember to do all digits for the version even if they're 0 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports # brain damage and presumably various other packaging systems too -our $VERSION = '0.03003'; +our $VERSION = '0.03004'; __PACKAGE__->mk_classaccessor('dump_to_dir'); __PACKAGE__->mk_classaccessor('loader'); diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 14d7123..16ce373 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -402,12 +402,11 @@ sub _inject { sub _load_classes { my $self = shift; - my $schema = $self->schema; - my $schema_class = $self->schema_class; - - my $constraint = $self->constraint; - my $exclude = $self->exclude; - my @tables = sort $self->_tables_list; + my $schema = $self->schema; + my $schema_class = $self->schema_class; + my $constraint = $self->constraint; + my $exclude = $self->exclude; + my @tables = sort $self->_tables_list; warn "No tables found in database, nothing to load" if !@tables; @@ -435,9 +434,8 @@ sub _load_classes { local *Class::C3::reinitialize = sub { }; use warnings; - { no strict 'refs'; - @{"${table_class}::ISA"} = qw/DBIx::Class/; - } + { no strict 'refs'; @{"${table_class}::ISA"} = qw/DBIx::Class/ } + $self->_use ($table_class, @{$self->additional_classes}); $self->_inject($table_class, @{$self->additional_base_classes}); @@ -457,7 +455,18 @@ sub _load_classes { $self->_dbic_stmt($table_class,'table',$table); my $cols = $self->_table_columns($table); - $self->_dbic_stmt($table_class,'add_columns',@$cols); + my $col_info; + eval { $col_info = $schema->storage->columns_info_for($table) }; + if($@) { + $self->_dbic_stmt($table_class,'add_columns',@$cols); + } + else { + my %cols_hash; + foreach my $col (@$cols) { + $cols_hash{$col} = \%{($col_info->{$col})}; + } + $self->_dbic_stmt($table_class,'add_columns',%cols_hash); + } my $pks = $self->_table_pk_info($table) || []; @$pks ? $self->_dbic_stmt($table_class,'set_primary_key',@$pks) diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 8e9800c..62bb632 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -230,7 +230,7 @@ sub run_tests { ok($new_obj1) or diag "Cannot find newly inserted PK::Auto record"; is($new_obj1->id, $saved_id); - my ($obj2) = $rsobj2->find( dat => 'bbb' ); + my ($obj2) = $rsobj2->search({ dat => 'bbb' })->first; is( $obj2->id, 2 ); SKIP: {