# 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';
$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)) {
name => "$uniq",
fields => $unique_constraints{$uniq}
);
+
+ my $index = $table->add_index(
+ name => $unique_constraints{$uniq}->[0],
+ fields => $unique_constraints{$uniq},
+ type => 'NORMAL',
+ );
+
}
}
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,
);
my $index = $table->add_index(
- name => $table->name . "_fk_$keys[0]",
+ name => $keys[0],
fields => \@keys,
type => 'NORMAL',
);