From: Ash Berlin Date: Sat, 24 Nov 2007 21:27:52 +0000 (+0000) Subject: Merge 'trunk' into 'versioned_enhancements' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3b9c0e6a15fe8b0838194a0f96d6fc2d098c9d7d;hp=-c;p=dbsrgits%2FDBIx-Class-Historic.git Merge 'trunk' into 'versioned_enhancements' r5181@metis (orig r3840): bert | 2007-10-25 11:04:42 +0100 r10510@beetle: bert | 2007-10-25 11:22:07 +0200 Merged with replication branch (fixed wrong object-function calls preventing set_schema to work rev3823). Added myself to contributors. r5182@metis (orig r3841): captainL | 2007-10-26 11:53:26 +0100 the checks in reverse_relationship_info are less ambiguous r5183@metis (orig r3842): ash | 2007-10-27 18:53:39 +0100 Reorder Changes file. (New changes go at bottom of block please!) r5185@metis (orig r3843): tomboh | 2007-10-29 17:19:01 +0000 Improve Documentation. r5186@metis (orig r3844): captainL | 2007-10-29 20:26:02 +0000 fixed _merge_attr bug r5187@metis (orig r3845): captainL | 2007-10-29 20:28:45 +0000 spelt Zby's name properly r8126@metis (orig r3852): castaway | 2007-11-03 02:17:11 +0000 Improve inflatecolumn docs r9392@metis (orig r3853): matthewt | 2007-11-06 14:53:48 +0000 make belongs_to accept an [] join cond r9632@metis (orig r3872): castaway | 2007-11-12 21:13:33 +0000 Added cookbook recipe for using dual, thanks Richard r9764@metis (orig r3879): ash | 2007-11-15 12:49:53 +0000 Fix is_foreign_key_constraint - thanks Jon Schutz r9766@metis (orig r3880): ash | 2007-11-15 13:02:15 +0000 Adding missing file r9767@metis (orig r3881): ash | 2007-11-15 13:52:58 +0000 Fix t/82cascade_copy.t r9812@metis (orig r3883): tomboh | 2007-11-15 15:05:12 +0000 Remove an unneeded requirement. r9814@metis (orig r3885): ash | 2007-11-16 14:30:51 +0000 Version bump r9896@metis (orig r3886): ash | 2007-11-19 18:11:53 +0000 Fix END block r11311@metis (orig r3887): wreis | 2007-11-21 13:57:35 +0000 minor fixes for ResultSet docs r11312@metis (orig r3888): ash | 2007-11-22 15:27:23 +0000 Fix mistakes r11454@metis (orig r3889): ash | 2007-11-24 21:24:53 +0000 Sort tables for consistent output --- 3b9c0e6a15fe8b0838194a0f96d6fc2d098c9d7d diff --combined Changes index 685ce11,4c5c48e..8f1ceaa --- a/Changes +++ b/Changes @@@ -1,6 -1,7 +1,10 @@@ Revision history for DBIx::Class + + - Versioning refactored + - Row::insert will now not fall over if passed duplicate related objects ++ + 0.08008 2007-11-16 14:30:00 + - Fixed join merging bug (test from Zby) - When adding relationships, it will throw an exception if you get the foreign and self parts the wrong way round in the condition - ResultSetColumn::func() now returns all results if called in list @@@ -15,6 -16,11 +19,11 @@@ RedHat systems from perl-5.8.8-10 and up that have the bless/overload patch applied (badly) which causes 2x -> 100x performance penalty. (Jon Schutz) + - ResultSource::reverse_relationship_info can distinguish between + sources using the same table + - Row::insert will now not fall over if passed duplicate related objects + - Row::copy will not fall over if you have two relationships to the + same source with a unique constraint on it 0.08007 2007-09-04 19:36:00 - patch for Oracle datetime inflation (abram@arin.net) diff --combined lib/SQL/Translator/Parser/DBIx/Class.pm index 0138050,ac91446..1433a52 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@@ -65,7 -65,7 +65,7 @@@ sub parse } - foreach my $moniker (@monikers) + foreach my $moniker (sort @monikers) { my $source = $dbixschema->source($moniker); @@@ -96,13 -96,6 +96,13 @@@ $table->primary_key($source->primary_columns); my @primary = $source->primary_columns; + foreach my $field (@primary) { + my $index = $table->add_index( + name => $field, + fields => [$field], + type => 'NORMAL', + ); + } my %unique_constraints = $source->unique_constraints; foreach my $uniq (keys %unique_constraints) { if (!$source->compare_relationship_keys($unique_constraints{$uniq}, \@primary)) { @@@ -111,13 -104,6 +111,13 @@@ name => "$uniq", fields => $unique_constraints{$uniq} ); + + my $index = $table->add_index( + name => $unique_constraints{$uniq}->[0], + fields => $unique_constraints{$uniq}, + type => 'NORMAL', + ); + } } @@@ -125,7 -111,7 +125,7 @@@ my %created_FK_rels; - foreach my $rel (@rels) + foreach my $rel (sort @rels) { my $rel_info = $source->relationship_info($rel); @@@ -163,31 -149,22 +163,31 @@@ # us to another table. # OR: If is_foreign_key_constraint attr is explicity set (or set to false) on the relation if ( ! exists $created_FK_rels{$rel_table}->{$key_test} && - ( exists $rel_info->{attrs}{is_foreign_key_constraint} && - $rel_info->{attrs}{is_foreign_key_constraint} || + ( exists $rel_info->{attrs}{is_foreign_key_constraint} ? + $rel_info->{attrs}{is_foreign_key_constraint} : !$source->compare_relationship_keys(\@keys, \@primary) - ) + ) ) { $created_FK_rels{$rel_table}->{$key_test} = 1; - $table->add_constraint( - type => 'foreign_key', - name => "fk_$keys[0]", - fields => \@keys, - reference_fields => \@refkeys, - reference_table => $rel_table, - on_delete => $on_delete, - on_update => $on_update - ); + if (scalar(@keys)) { + $table->add_constraint( + type => 'foreign_key', + name => $table->name . "_fk_$keys[0]", + fields => \@keys, + reference_fields => \@refkeys, + reference_table => $rel_table, + on_delete => $on_delete, + on_update => $on_update + ); + + my $index = $table->add_index( + name => $keys[0], + fields => \@keys, + type => 'NORMAL', + ); + } + } } }