diff options
-rw-r--r-- | Bugzilla/DB.pm | 2 | ||||
-rw-r--r-- | Bugzilla/DB/Oracle.pm | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index cc4ddb9aa..ff3ea0d4c 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -684,7 +684,7 @@ sub bz_add_field_tables { if ($field->type == FIELD_TYPE_MULTI_SELECT) { my $ms_table = "bug_" . $field->name; $self->_bz_add_field_table($ms_table, - $self->_bz_schema->MULTI_SELECT_VALUE_TABLE); + $self->_bz_schema->MULTI_SELECT_VALUE_TABLE, $field->type); $self->bz_add_fk($ms_table, 'bug_id', {TABLE => 'bugs', COLUMN => 'bug_id', diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index c8195d4a7..854b72a43 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -208,6 +208,15 @@ sub sql_in { return "( " . join(" OR ", @in_str) . " )"; } +sub _bz_add_field_table { + my ($self, $name, $schema_ref, $type) = @_; + $self->SUPER::_bz_add_field_table($name, $schema_ref); + if (defined($type) && $type == FIELD_TYPE_MULTI_SELECT) { + my $uk_name = "UK_" . $self->_bz_schema->_hash_identifier($name . '_value'); + $self->do("ALTER TABLE $name ADD CONSTRAINT $uk_name UNIQUE(value)"); + } +} + sub bz_drop_table { my ($self, $name) = @_; my $table_exists = $self->bz_table_info($name); |