From 8d0710acaba90364e20af1cb9d23a8ad62f3bcd3 Mon Sep 17 00:00:00 2001 From: Xiaoou Wu Date: Mon, 1 Mar 2010 15:26:08 -0800 Subject: Bug 541553: [Oracle] Drop triggers when dropping columns, and drop the left-behind PRODUCTS_MILESTONEURL trigger that currently exists in 3.6/trunk. r=mkanat, a=mkanat --- Bugzilla/DB/Oracle.pm | 8 ++++++++ Bugzilla/DB/Schema/Oracle.pm | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'Bugzilla/DB') diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index 801823372..5dd127882 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -676,6 +676,14 @@ sub bz_setup_database { } } + # Drop the trigger which causes bug 541553 + my $trigger_name = "PRODUCTS_MILESTONEURL"; + my $exist_trigger = $self->selectcol_arrayref( + "SELECT OBJECT_NAME FROM USER_OBJECTS + WHERE OBJECT_NAME = ?", undef, $trigger_name); + if(@$exist_trigger) { + $self->do("DROP TRIGGER $trigger_name"); + } } package Bugzilla::DB::Oracle::st; diff --git a/Bugzilla/DB/Schema/Oracle.pm b/Bugzilla/DB/Schema/Oracle.pm index 814a842b3..e8905eb80 100644 --- a/Bugzilla/DB/Schema/Oracle.pm +++ b/Bugzilla/DB/Schema/Oracle.pm @@ -412,4 +412,20 @@ sub get_set_serial_sql { return @sql; } +sub get_drop_column_ddl { + my $self = shift; + my ($table, $column) = @_; + my @sql; + push(@sql, $self->SUPER::get_drop_column_ddl(@_)); + my $dbh=Bugzilla->dbh; + my $trigger_name = uc($table . "_" . $column); + my $exist_trigger = $dbh->selectcol_arrayref( + "SELECT OBJECT_NAME FROM USER_OBJECTS + WHERE OBJECT_NAME = ?", undef, $trigger_name); + if(@$exist_trigger) { + push(@sql, "DROP TRIGGER $trigger_name"); + } + return @sql; +} + 1; -- cgit v1.2.3-24-g4f1b