From 2c536d9c715f931d06e28850dba33241f43a078c Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sat, 4 Apr 2009 04:11:25 +0000 Subject: Bug 486239: [Oracle] Missing keyword RESTRICT on fk creation (DB::Schema explicitly specified DELETE => 'RESTRICT') Patch by Xiaoou Wu and Max Kanat-Alexander r=mkanat --- Bugzilla/DB/Schema.pm | 3 +-- Bugzilla/DB/Schema/Oracle.pm | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'Bugzilla/DB') diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 7f094983f..fc4361d17 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -381,8 +381,7 @@ use constant ABSTRACT_SCHEMA => { DELETE => 'CASCADE'}}, who => {TYPE => 'INT3', NOTNULL => 1, REFERENCES => {TABLE => 'profiles', - COLUMN => 'userid', - DELETE => 'RESTRICT'}}, + COLUMN => 'userid'}}, bug_when => {TYPE => 'DATETIME', NOTNULL => 1}, work_time => {TYPE => 'decimal(5,2)', NOTNULL => 1, DEFAULT => '0'}, diff --git a/Bugzilla/DB/Schema/Oracle.pm b/Bugzilla/DB/Schema/Oracle.pm index 8332be707..d8b24e49b 100644 --- a/Bugzilla/DB/Schema/Oracle.pm +++ b/Bugzilla/DB/Schema/Oracle.pm @@ -145,6 +145,9 @@ sub get_fk_ddl { my $to_column = $references->{COLUMN} || confess "No column in reference"; my $fk_name = $self->_get_fk_name($table, $column, $references); + # 'ON DELETE RESTRICT' is enabled by default + $delete = "" if ($delete =~ /RESTRICT/i); + my $fk_string = "\n CONSTRAINT $fk_name FOREIGN KEY ($column)\n" . " REFERENCES $to_table($to_column)\n"; -- cgit v1.2.3-24-g4f1b