[Bast-commits] r3815 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class
lib/SQL/Translator/Parser/DBIx t/lib/DBICTest/Schema
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Fri Oct 12 18:46:56 GMT 2007
Author: ash
Date: 2007-10-12 18:46:55 +0100 (Fri, 12 Oct 2007)
New Revision: 3815
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSourceProxy.pm
DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm
DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Artist.pm
Log:
Remove add_index and replace it with sqlt_deploy_hook
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2007-10-12 10:32:41 UTC (rev 3814)
+++ DBIx-Class/0.08/trunk/Changes 2007-10-12 17:46:55 UTC (rev 3815)
@@ -8,8 +8,8 @@
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 at arin.net)
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2007-10-12 10:32:41 UTC (rev 3814)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2007-10-12 17:46:55 UTC (rev 3815)
@@ -13,7 +13,7 @@
__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/);
@@ -55,7 +55,6 @@
$new->{_relationships} = { %{$new->{_relationships}||{}} };
$new->{name} ||= "!!NAME NOT SET!!";
$new->{_columns_info_loaded} ||= 0;
- $new->_indexes([]) unless $new->_indexes;
return $new;
}
@@ -450,30 +449,6 @@
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);
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSourceProxy.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSourceProxy.pm 2007-10-12 10:32:41 UTC (rev 3814)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSourceProxy.pm 2007-10-12 17:46:55 UTC (rev 3815)
@@ -104,12 +104,4 @@
shift->result_source_instance->relationship_info(@_);
}
-sub add_index {
- shift->result_source_instance->add_index(@_);
-}
-
-sub indexes {
- shift->result_source_instance->indexes(@_);
-}
-
1;
Modified: DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm 2007-10-12 10:32:41 UTC (rev 3814)
+++ DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm 2007-10-12 17:46:55 UTC (rev 3815)
@@ -109,11 +109,6 @@
}
}
- foreach my $idx ( $source->indexes ) {
- my $ret = $table->add_index(%$idx)
- or die $table->error;
- }
-
my @rels = $source->relationships();
my %created_FK_rels;
@@ -175,6 +170,10 @@
}
}
}
+
+ if ($source->result_class->can('sqlt_deploy_hook')) {
+ $source->result_class->sqlt_deploy_hook($table);
+ }
}
return 1;
}
Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Artist.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Artist.pm 2007-10-12 10:32:41 UTC (rev 3814)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Artist.pm 2007-10-12 17:46:55 UTC (rev 3815)
@@ -41,6 +41,11 @@
{ 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;
More information about the Bast-commits
mailing list