diff options
author | mkanat%bugzilla.org <> | 2008-11-05 23:27:11 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-11-05 23:27:11 +0000 |
commit | 17cf16167f43217f8f878693347b1e170126daaa (patch) | |
tree | 3ca5b7bdecfb2428626566440c485c4fd757d736 /Bugzilla | |
parent | 81c5ce1dc742b256c692a61c4369f7ecce114cde (diff) | |
download | bugs-17cf16167f43217f8f878693347b1e170126daaa.tar bugs-17cf16167f43217f8f878693347b1e170126daaa.tar.gz bugs-17cf16167f43217f8f878693347b1e170126daaa.tar.bz2 bugs-17cf16167f43217f8f878693347b1e170126daaa.tar.xz bugs-17cf16167f43217f8f878693347b1e170126daaa.zip |
Bug 460421: [Oracle] Adding custom fields with type FIELD_TYPE_MULTI_SELECT requires a unique constraint on the "value" column
Patch By Xiaoou Wu <xiaoou.wu@oracle.com> r=mkanat, a=mkanat
Diffstat (limited to 'Bugzilla')
-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); |