summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB/Schema
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2008-05-08 06:18:36 +0200
committermkanat%bugzilla.org <>2008-05-08 06:18:36 +0200
commit03ee2cb6ced142b7663d6fc28512bbc8ac3c2b29 (patch)
tree14298b06bb7c687adbf729f8cf197de12f1ccc56 /Bugzilla/DB/Schema
parent5ff69349e2abc5290fa805ae05297d581239f6ba (diff)
downloadbugzilla-03ee2cb6ced142b7663d6fc28512bbc8ac3c2b29.tar.gz
bugzilla-03ee2cb6ced142b7663d6fc28512bbc8ac3c2b29.tar.xz
Bug 432726: [Oracle] DROP INDEX doesn't hash the index name
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
Diffstat (limited to 'Bugzilla/DB/Schema')
-rw-r--r--Bugzilla/DB/Schema/Oracle.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/Bugzilla/DB/Schema/Oracle.pm b/Bugzilla/DB/Schema/Oracle.pm
index 43a12dc89..6b6fa5c57 100644
--- a/Bugzilla/DB/Schema/Oracle.pm
+++ b/Bugzilla/DB/Schema/Oracle.pm
@@ -105,7 +105,7 @@ sub get_table_ddl {
sub _get_create_index_ddl {
my ($self, $table_name, $index_name, $index_fields, $index_type) = @_;
- $index_name = "idx_" . substr(md5_hex($index_name),0,20);
+ $index_name = "idx_" . $self->_hash_index_name($index_name);
if ($index_type eq 'FULLTEXT') {
my $sql = "CREATE INDEX $index_name ON $table_name ("
. join(',',@$index_fields)
@@ -117,7 +117,19 @@ sub _get_create_index_ddl {
return($self->SUPER::_get_create_index_ddl($table_name, $index_name,
$index_fields, $index_type));
-} #eosub--_get_create_index_ddl
+}
+
+sub get_drop_index_ddl {
+ my $self = shift;
+ my ($table, $name) = @_;
+
+ $name = 'idx_' . $self->_hash_index_name($name);
+ return $self->SUPER::get_drop_index_ddl($table, $name);
+}
+
+sub _hash_index_name {
+ return substr(md5_hex($_[1]),0,20);
+}
# Oracle supports the use of FOREIGN KEY integrity constraints
# to define the referential integrity actions, including:
@@ -175,7 +187,7 @@ sub _get_fk_name {
my $to_table = $references->{TABLE};
my $to_column = $references->{COLUMN};
my $fk_name = "${table}_${column}_${to_table}_${to_column}";
- $fk_name = "fk_" . substr(md5_hex($fk_name),0,20);
+ $fk_name = "fk_" . $self->_hash_index_name($fk_name);
return $fk_name;
}