Revision history for Perl extension DBIx::Class::Schema::Loader
+ - Relationship names for multiple multi-col rels between
+ the same table fixed by ilmari
+ - Fix from Marc Espie for CREATE TABLE 'foo' for SQLite
- skip ^sqlite_ tables in SQLite (thanks chromatic)
+0.03999_01 Sat Apr 14 19:57:40 GMT 2007
+ - Added *experimental* Oracle support from work done
+ by Tsunoda Kazuya some months ago. Not well tested.
+ - Added "rescan" schema (and loader) method, which picks
+ up newly created tables at runtime
+ - Made dump_to_dir / dump_overwrite much more intelligent
+ (they now preserve customizations by default)
+ - Added support for DBI's new standard "statistics_info"
+ method to gather unique key info (only supported by
+ DBD::Pg trunk afaik)
+ - columns_info_for imported from DBIx::Class
+ - relationships are now on by default, use skip_relationships
+ to disable them
+ - Removed previously deprecated methods/options
+ - Added $VERSION to all packages in this dist
+
0.03011 Sat Apr 14 19:03:07 UTC 2007
- fix case-sensitivity in UNIQUE parsing for SQLite
my $all_code = {};
- foreach my $local_moniker (keys %{$self->{fk_info}}) {
- my $local_table = $self->{schema}->source($local_moniker)->from;
- my $local_class = $self->{schema}->class($local_moniker);
- my $rels = $self->{fk_info}->{$local_moniker};
+ my $local_table = $self->{schema}->source($local_moniker)->from;
+ my $local_class = $self->{schema}->class($local_moniker);
- my %counters;
- foreach my $rel (@$rels) {
- next if !$rel->{remote_source};
- $counters{$rel->{remote_source}}++;
+ my %counters;
+ foreach my $rel (@$rels) {
+ next if !$rel->{remote_source};
+ $counters{$rel->{remote_source}}++;
+ }
+
+ foreach my $rel (@$rels) {
+ next if !$rel->{remote_source};
+ my $local_cols = $rel->{local_columns};
+ my $remote_cols = $rel->{remote_columns};
+ my $remote_moniker = $rel->{remote_source};
+ my $remote_obj = $self->{schema}->source($remote_moniker);
+ my $remote_class = $self->{schema}->class($remote_moniker);
+ my $remote_table = $remote_obj->from;
+ $remote_cols ||= [ $remote_obj->primary_columns ];
+
+ if($#$local_cols != $#$remote_cols) {
+ croak "Column count mismatch: $local_moniker (@$local_cols) "
+ . "$remote_moniker (@$remote_cols)";
}
- foreach my $rel (@$rels) {
- next if !$rel->{remote_source};
- my $local_cols = $rel->{local_columns};
- my $remote_cols = $rel->{remote_columns};
- my $remote_moniker = $rel->{remote_source};
- my $remote_obj = $self->{schema}->source($remote_moniker);
- my $remote_class = $self->{schema}->class($remote_moniker);
- my $remote_table = $remote_obj->from;
- $remote_cols ||= [ $remote_obj->primary_columns ];
-
- if($#$local_cols != $#$remote_cols) {
- croak "Column count mismatch: $local_moniker (@$local_cols) "
- . "$remote_moniker (@$remote_cols)";
- }
+ my %cond;
+ foreach my $i (0 .. $#$local_cols) {
+ $cond{$remote_cols->[$i]} = $local_cols->[$i];
+ }
- # If more than one rel between this pair of tables, use the
- # local col name(s) as the relname in the foreign source, instead
- # of the local table name.
- my %cond;
- foreach my $i (0 .. $#$local_cols) {
- $cond{$remote_cols->[$i]} = $local_cols->[$i];
- }
+ my $local_relname;
- if($counters{$remote_moniker} > 1) {
- $local_relname = $self->_inflect_plural(
- lc($local_table) . q{_} . join(q{_}, @$local_cols)
- );
- } else {
- $local_relname = $self->_inflect_plural(lc $local_table);
- }
-
- # for single-column case, set the relname to the column name,
- # to make filter accessors work
+ my $remote_relname;
+
- my $local_relname;
- my $remote_relname;
++ # for single-column case, set the remote relname to the column
++ # name, to make filter accessors work
+ if(scalar keys %cond == 1) {
+ my ($col) = keys %cond;
+ $remote_relname = $self->_inflect_singular($cond{$col});
+ }
+ else {
+ $remote_relname = $self->_inflect_singular(lc $remote_table);
+ }
- # for single-column case, set the remote relname to the column
- # name, to make filter accessors work
- if(scalar keys %cond == 1) {
- my ($col) = keys %cond;
- $remote_relname = $self->_inflect_singular($cond{$col});
- }
- else {
- $remote_relname = $self->_inflect_singular(lc $remote_table);
- }
++ # If more than one rel between this pair of tables, use the local
++ # col names to distinguish
++ if($counters{$remote_moniker} > 1) {
++ my $colnames = q{_} . join(q{_}, @$local_cols);
++ $local_relname = $self->_inflect_plural(
++ lc($local_table) . $colnames
++ );
++ $remote_relname .= $colnames if keys %cond > 1;
++ } else {
++ $local_relname = $self->_inflect_plural(lc $local_table);
++ }
+
- # If more than one rel between this pair of tables, use the local
- # col names to distinguish
- if($counters{$remote_moniker} > 1) {
- my $colnames = q{_} . join(q{_}, @$local_cols);
- $local_relname = $self->_inflect_plural(
- lc($local_table) . $colnames
- );
- $remote_relname .= $colnames if keys %cond > 1;
- } else {
- $local_relname = $self->_inflect_plural(lc $local_table);
- }
+ my %rev_cond = reverse %cond;
- my %rev_cond = reverse %cond;
+ for (keys %rev_cond) {
+ $rev_cond{"foreign.$_"} = "self.".$rev_cond{$_};
+ delete $rev_cond{$_};
+ }
- for (keys %rev_cond) {
- $rev_cond{"foreign.$_"} = "self.".$rev_cond{$_};
- delete $rev_cond{$_};
+ push(@{$all_code->{$local_class}},
+ { method => 'belongs_to',
+ args => [ $remote_relname,
+ $remote_class,
+ \%cond,
+ ],
}
-
- push(@{$all_code->{$local_class}},
- { method => 'belongs_to',
- args => [ $remote_relname,
- $remote_class,
- \%cond,
- ],
- }
- );
-
- push(@{$all_code->{$remote_class}},
- { method => 'has_many',
- args => [ $local_relname,
- $local_class,
- \%rev_cond,
- ],
- }
- );
- }
+ );
+
+ push(@{$all_code->{$remote_class}},
+ { method => 'has_many',
+ args => [ $local_relname,
+ $local_class,
+ \%rev_cond,
+ ],
+ }
+ );
}
return $all_code;