Closed Bug 527489 Opened 16 years ago Closed 16 years ago

calls to bz_alter_column on FK referenced columns will lose their referenced status in bz_schema unless the REFERENCES hash is included

Categories

(Bugzilla :: Database, defect)

x86
Linux
defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 3.6

People

(Reporter: gregaryh, Assigned: mkanat)

Details

Attachments

(1 file)

This affects bugzilla 3.2+ Any calls to bz_alter_schema will overwrite the references section if they are not explicitly included in the call.
Attached patch v1Splinter Review
Does this fix things, ghendricks?
Assignee: database → mkanat
Status: NEW → ASSIGNED
Attachment #411471 - Flags: review?(ghendricks)
Comment on attachment 411471 [details] [diff] [review] v1 >+ # Preserve foreign key definitions in the Schema object when altering >+ # types. >+ if (defined $current_def->{REFERENCES}) { >+ # Make sure we don't modify the caller's $new_def. >+ $new_def = dclone($new_def); >+ $new_def->{REFERENCES} = $current_def->{REFERENCES}; >+ } One question. How do we alter a foreign key? For example if we need to change from CASCADE delete to something else? Should there be a separate bz_alter_fk? Or do we just want to drop and recreate?
(In reply to comment #2) > One question. How do we alter a foreign key? For example if we need to change > from CASCADE delete to something else? Should there be a separate bz_alter_fk? > Or do we just want to drop and recreate? You just drop and re-create, for now.
Attachment #411471 - Flags: review?(ghendricks) → review+
ghendricks: Did you test this patch against the problem you were having?
Flags: approval+
Checking in Bugzilla/DB.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB.pm,v <-- DB.pm new revision: 1.131; previous revision: 1.130 done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → Bugzilla 3.6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: