summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-01-24 18:41:55 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2012-01-24 18:41:55 +0100
commite2a95ffbe2beb52bf3e69102b4646ddf5793d8df (patch)
tree2984c82cc76e749d5aa3f032831ddf41e568e8b2
parent7d8c9ccfb3c5983968ff5ae1b38471be18a49501 (diff)
downloadbugzilla-e2a95ffbe2beb52bf3e69102b4646ddf5793d8df.tar.gz
bugzilla-e2a95ffbe2beb52bf3e69102b4646ddf5793d8df.tar.xz
Bug 715870: [Oracle] Related sequences and triggers must be removed when dropping a table
r=mkanat a=LpSolit
-rw-r--r--Bugzilla/DB/Schema/Oracle.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/Bugzilla/DB/Schema/Oracle.pm b/Bugzilla/DB/Schema/Oracle.pm
index cdc39409d..f2d5b8be0 100644
--- a/Bugzilla/DB/Schema/Oracle.pm
+++ b/Bugzilla/DB/Schema/Oracle.pm
@@ -386,13 +386,31 @@ sub get_rename_table_sql {
}
if ($def->{TYPE} =~ /varchar|text/i && $def->{NOTNULL}) {
push(@sql, _get_notnull_trigger_ddl($new_name, $column));
- push(@sql, "DROP TRIGGER ${$old_name}_${column}");
+ push(@sql, "DROP TRIGGER ${old_name}_${column}");
}
}
return @sql;
}
+sub get_drop_table_ddl {
+ my ($self, $name) = @_;
+ my @sql;
+
+ my @columns = $self->get_table_columns($name);
+ foreach my $column (@columns) {
+ my $def = $self->get_column_abstract($name, $column);
+ if ($def->{TYPE} =~ /SERIAL/i) {
+ # If there's a SERIAL column on this table, we also need
+ # to remove the sequence.
+ push(@sql, "DROP SEQUENCE ${name}_${column}_SEQ");
+ }
+ }
+ push(@sql, "DROP TABLE $name CASCADE CONSTRAINTS PURGE");
+
+ return @sql;
+}
+
sub _get_notnull_trigger_ddl {
my ($table, $column) = @_;