summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-01-24 18:39:47 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2012-01-24 18:39:47 +0100
commit6822aab9300fc5355c10ba90f2e3f0a2ebd583a8 (patch)
tree82c0d43df5e6d546513d83288e3fc7a1d0b0ba59 /Bugzilla
parent99047442fabe467df7219e889645aa5cac84b9bf (diff)
downloadbugzilla-6822aab9300fc5355c10ba90f2e3f0a2ebd583a8.tar.gz
bugzilla-6822aab9300fc5355c10ba90f2e3f0a2ebd583a8.tar.xz
Bug 715870: [Oracle] Related sequences and triggers must be removed when dropping a table
r=mkanat a=LpSolit
Diffstat (limited to 'Bugzilla')
-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 549ed617a..f6a55b479 100644
--- a/Bugzilla/DB/Schema/Oracle.pm
+++ b/Bugzilla/DB/Schema/Oracle.pm
@@ -371,13 +371,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) = @_;