[Bast-commits] r3832 - in
DBIx-Class/0.08/branches/versioned_enhancements: .
lib/SQL/Translator/Parser/DBIx
captainL at dev.catalyst.perl.org
captainL at dev.catalyst.perl.org
Tue Oct 23 15:08:47 GMT 2007
Author: captainL
Date: 2007-10-23 15:08:46 +0100 (Tue, 23 Oct 2007)
New Revision: 3832
Modified:
DBIx-Class/0.08/branches/versioned_enhancements/Makefile.PL
DBIx-Class/0.08/branches/versioned_enhancements/lib/SQL/Translator/Parser/DBIx/Class.pm
Log:
changed constraint and index generation to be consistent with DB defaults
Modified: DBIx-Class/0.08/branches/versioned_enhancements/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/versioned_enhancements/Makefile.PL 2007-10-23 12:18:13 UTC (rev 3831)
+++ DBIx-Class/0.08/branches/versioned_enhancements/Makefile.PL 2007-10-23 14:08:46 UTC (rev 3832)
@@ -22,7 +22,7 @@
# Perl 5.8.0 doesn't have utf8::is_utf8()
requires 'Encode' => 0 if ($] <= 5.008000);
-build_requires 'DBD::SQLite' => 1.14;
+build_requires 'DBD::SQLite' => 1.13;
build_requires 'Test::Builder' => 0.33;
install_script 'script/dbicadmin';
Modified: DBIx-Class/0.08/branches/versioned_enhancements/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/versioned_enhancements/lib/SQL/Translator/Parser/DBIx/Class.pm 2007-10-23 12:18:13 UTC (rev 3831)
+++ DBIx-Class/0.08/branches/versioned_enhancements/lib/SQL/Translator/Parser/DBIx/Class.pm 2007-10-23 14:08:46 UTC (rev 3832)
@@ -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)) {
@@ -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',
+ );
+
}
}
@@ -159,7 +173,7 @@
if (scalar(@keys)) {
$table->add_constraint(
type => 'foreign_key',
- name => "fk_$keys[0]",
+ name => $table->name . "_fk_$keys[0]",
fields => \@keys,
reference_fields => \@refkeys,
reference_table => $rel_table,
@@ -168,7 +182,7 @@
);
my $index = $table->add_index(
- name => $table->name . "_fk_$keys[0]",
+ name => $keys[0],
fields => \@keys,
type => 'NORMAL',
);
More information about the Bast-commits
mailing list