summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-09-09 08:11:40 +0200
committerlpsolit%gmail.com <>2006-09-09 08:11:40 +0200
commita806b298f5bfe5914f27a1419d27366fe59da449 (patch)
tree25d737aeb60f17360de9a67f2017369a4d5d8349 /Bugzilla/DB.pm
parent27c1be36a3cbc57e01c8d51af85be76b0748ece6 (diff)
downloadbugzilla-a806b298f5bfe5914f27a1419d27366fe59da449.tar.gz
bugzilla-a806b298f5bfe5914f27a1419d27366fe59da449.tar.xz
Bug 287326: Ability to add custom single-select fields to a bug - Patch by Frédéric Buclin <LpSolit@gmail.com> and Max Kanat-Alexander <mkanat@bugzilla.org> r=mkanat a=myk
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 077f93cf7..5fceb961d 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -577,10 +577,25 @@ sub bz_add_table {
sub _bz_add_table_raw {
my ($self, $name) = @_;
my @statements = $self->_bz_schema->get_table_ddl($name);
- print "Adding new table $name ...\n";
+ print "Adding new table $name ...\n" unless i_am_cgi();
$self->do($_) foreach (@statements);
}
+sub bz_add_field_table {
+ my ($self, $name) = @_;
+ my $table_schema = $self->_bz_schema->FIELD_TABLE_SCHEMA;
+ my $indexes = $table_schema->{INDEXES};
+ # $indexes is an arrayref, not a hash. In order to fix the keys,
+ # we have to fix every other item.
+ for (my $i = 0; $i < scalar @$indexes; $i++) {
+ next if ($i % 2 && $i != 0); # We skip 1, 3, 5, 7, etc.
+ $indexes->[$i] = $name . "_" . $indexes->[$i];
+ }
+ # We add this to the abstract schema so that bz_add_table can find it.
+ $self->_bz_schema->add_table($name, $table_schema);
+ $self->bz_add_table($name);
+}
+
sub bz_drop_column {
my ($self, $table, $column) = @_;