clash
- InflateColumn::DateTime now accepts an extra parameter of timezone
to set timezone on the DT object (thanks Sergio Salvi)
- - ResultSource now has an add_index method to add indices for when
- using SQL::Translator to create tables/SQL.
+ - Added sqlt_deploy_hook to result classes so that indexes can be
+ added.
0.08007 2007-09-04 19:36:00
- patch for Oracle datetime inflation (abram@arin.net)
__PACKAGE__->mk_group_accessors('simple' => qw/_ordered_columns
_columns _primaries _unique_constraints name resultset_attributes
schema from _relationships column_info_from_storage source_info
- source_name _indexes/);
+ source_name/);
__PACKAGE__->mk_group_accessors('component_class' => qw/resultset_class
result_class/);
$new->{_relationships} = { %{$new->{_relationships}||{}} };
$new->{name} ||= "!!NAME NOT SET!!";
$new->{_columns_info_loaded} ||= 0;
- $new->_indexes([]) unless $new->_indexes;
return $new;
}
sub storage { shift->schema->storage; }
-=head2 add_index
-
-Add an index to the result source. This has no effect for DBIx::Class - it is
-just used for creating SQL with L<SQL::Translator>. Takes the same arguments
-as L<SQL::Translator::Schema::Table::add_index>.
-
-=cut
-
-sub add_index {
- my ($self, $idx) = @_;
-
- push @{ $self->_indexes }, $idx;
-}
-
-=head2 indexes
-
-Returns list of secondary (i.e. non unique) indexes created on this table.
-
-=cut
-
-sub indexes {
- return @{ shift->_indexes };
-}
-
=head2 add_relationship
$source->add_relationship('relname', 'related_source', $cond, $attrs);
shift->result_source_instance->relationship_info(@_);
}
-sub add_index {
- shift->result_source_instance->add_index(@_);
-}
-
-sub indexes {
- shift->result_source_instance->indexes(@_);
-}
-
1;
}
}
- foreach my $idx ( $source->indexes ) {
- my $ret = $table->add_index(%$idx)
- or die $table->error;
- }
-
my @rels = $source->relationships();
my %created_FK_rels;
}
}
}
+
+ if ($source->result_class->can('sqlt_deploy_hook')) {
+ $source->result_class->sqlt_deploy_hook($table);
+ }
}
return 1;
}
{ cascade_copy => 0 } # this would *so* not make sense
);
-__PACKAGE__->add_index({ name => 'artist_name', fields => ['name'],});
+sub sqlt_deploy_hook {
+ my ($self, $sqlt_table) = @_;
+
+ $sqlt_table->add_index( name => 'artist_name', fields => ['name'] )
+ or die $sqlt_table->error;
+}
1;