Allon Mureinik has posted comments on this change.

Change subject: engine: Move quota to Image_storage_domain_map
......................................................................


Patch Set 5:

(2 comments)

The upgrade script should be made reenterant.

Also, see inline comments.

....................................................
File packaging/dbscripts/upgrade/03_04_0050_move_quota_id.sql
Line 1: -- add quota id column to the image-storage map table
Line 2: SELECT fn_db_add_column('image_storage_domain_map','quota_id', 'UUID 
NULL');
Line 3: -- create a FK to quota table to that column
Line 4: ALTER TABLE image_storage_domain_map ADD CONSTRAINT 
fk_image_storage_domain_map_quota FOREIGN KEY (quota_id) REFERENCES quota(id) 
ON DELETE SET NULL;
This should be done after the UPDATE.
Line 5: -- copy old quota from images table
Line 6: UPDATE image_storage_domain_map SET quota_id = (SELECT quota_id FROM 
images WHERE image_id = image_guid);
Line 7: -- remove quota_id column from images table


Line 4: ALTER TABLE image_storage_domain_map ADD CONSTRAINT 
fk_image_storage_domain_map_quota FOREIGN KEY (quota_id) REFERENCES quota(id) 
ON DELETE SET NULL;
Line 5: -- copy old quota from images table
Line 6: UPDATE image_storage_domain_map SET quota_id = (SELECT quota_id FROM 
images WHERE image_id = image_guid);
Line 7: -- remove quota_id column from images table
Line 8: ALTER TABLE images DROP column quota_id;
Use fn_db_drop_column


-- 
To view, visit http://gerrit.ovirt.org/20097
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Icc81b077cf125de85fcb3586bc0d0f71e5e0716a
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to