Commit 70a3ca18 authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

Bug 519035: Make the FK for series.creator have ON DELETE CASCADE instead

of ON DELETE SET NULL r=LpSolit, a=LpSolit
parent abeb2964
...@@ -1248,7 +1248,7 @@ use constant ABSTRACT_SCHEMA => { ...@@ -1248,7 +1248,7 @@ use constant ABSTRACT_SCHEMA => {
creator => {TYPE => 'INT3', creator => {TYPE => 'INT3',
REFERENCES => {TABLE => 'profiles', REFERENCES => {TABLE => 'profiles',
COLUMN => 'userid', COLUMN => 'userid',
DELETE => 'SET NULL'}}, DELETE => 'CASCADE'}},
category => {TYPE => 'INT2', NOTNULL => 1, category => {TYPE => 'INT2', NOTNULL => 1,
REFERENCES => {TABLE => 'series_categories', REFERENCES => {TABLE => 'series_categories',
COLUMN => 'id', COLUMN => 'id',
......
...@@ -598,6 +598,7 @@ sub update_table_definitions { ...@@ -598,6 +598,7 @@ sub update_table_definitions {
_add_allows_unconfirmed_to_product_table(); _add_allows_unconfirmed_to_product_table();
_convert_flagtypes_fks_to_set_null(); _convert_flagtypes_fks_to_set_null();
_fix_decimal_types(); _fix_decimal_types();
_fix_series_creator_fk();
# 2009-11-14 dkl@redhat.com - Bug 310450 # 2009-11-14 dkl@redhat.com - Bug 310450
$dbh->bz_add_column('bugs_activity', 'comment_id', {TYPE => 'INT3'}); $dbh->bz_add_column('bugs_activity', 'comment_id', {TYPE => 'INT3'});
...@@ -3374,6 +3375,16 @@ sub _fix_decimal_types { ...@@ -3374,6 +3375,16 @@ sub _fix_decimal_types {
$dbh->bz_alter_column('longdescs', 'work_time', $type); $dbh->bz_alter_column('longdescs', 'work_time', $type);
} }
sub _fix_series_creator_fk {
my $dbh = Bugzilla->dbh;
my $fk = $dbh->bz_fk_info('series', 'creator');
# Change the FK from SET NULL to CASCADE. (It will be re-created
# automatically at the end of all DB changes.)
if ($fk and $fk->{DELETE} eq 'SET NULL') {
$dbh->bz_drop_fk('series', 'creator');
}
}
1; 1;
__END__ __END__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment